[Israel.pm] Quickie - Perl syntax

Alex Behar alex-b at actcom.net.il
Thu Oct 7 10:00:39 PDT 2004


On Wednesday 06 October 2004 12:51, Madani, Srikanth, VF-DE wrote:
| Hi all,
|
| I have these statements:
| #___________
| $line =~ s/\s*//g; #Remove whitespace from $line. BTW, $line is " 
| targetDir =M:\VDD\Bin32 " my @tdir_val = split /=/,$line;
| #___________
|
| a) How do I combine these two statements into one line?
| b) Is there someway I can do it in one line _without_ modifying $line?
|
| Cheers,
| Srikanth Madani
| I don't need a .sig - I'm going on vacation tomorrow!

Well, I came up with a different solution than the one Gaal Yahas posted, 
although I have to admit the map{} way was a nice idea.

mine is abit dirty:
foreach(split"-",$line){s/\s+//g;push at tdir_val,$_}



|
| _______________________________________________
| Perl mailing list
| Perl at perl.org.il
| http://perl.org.il/mailman/listinfo/perl

-- 
The difference between theory and practice, is that in theory, 
there is no difference between theory and practice.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20041007/5c35b727/attachment.pgp 


More information about the Perl mailing list