LA.pm: Regex
Samy Kamkar [CommPort5]
CommPort5 at LucidX.com
Fri Oct 19 17:55:00 CDT 2001
If I were you, I'd just do it in seperate functions...here's a way, but
there may be better ways (although best way is to just to first s///
then do the print :)
print join(", ", "foo", ($x->{'Foo'} =~ s/\s+//g) && $x->{'Foo'}, "bar\n");
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