LA.pm: Regex [Ack!]

Samy Kamkar [CommPort5] CommPort5 at LucidX.com
Fri Oct 19 18:01:12 CDT 2001


Ack!  Jeremy just sent in a better way (but his message bounced ... so 
I'm passing this along for him):

"



 print join ', ', 'foo', split(/\s+/, $hashref->{'Foo'}), 'bar'

Jeremy
-- "If you can talk you can sing. If you can walk you can dance." "

Arkadiy Sudarikov wrote:

>Call me dumb mofo, but... I still don't get it...
>
>I mean, I have this string in hash ref, accessible as $hashref->{'Foo'}.
>That string contains, like, numbers and spaces.
>
>Now, I need to do print join ', ', 'foo', $hashref->{'Foo'}, 'bar'; but I
>need to strip spaces from $hashref->{'Foo'}. So, how can I do my s/\s+//g
>within this context, on the same line? Something like print join ', ',
>'foo', $hashref->{'Foo'}=~ s/\s+//g, 'bar';
>
>Thanks for help,
>Private Arkadiy
>
>

-- 
Samy Kamkar -- (877) 898-1424 -- cp5 at LucidX.com
LucidX.com / LA.pm.org / pdump.org / code.LucidX.com






More information about the Losangeles-pm mailing list