in reply to Re^3: sanity check
in thread sanity check
What did I miss?
If you use -E instead of -e, you can save yourself from typing use 5.012; :)
C:\test>perl -E "my $foo='abc def';my @foo=split m/ /,$foo; for (@foo) + {say $_}" abc def
A little more by omitting the $_:
C:\test>perl -E "my $foo='abc def';my @foo=split m/ /,$foo; for (@foo) + {say}" abc def
More still by using the modifier form of for:
C:\test>perl -E "my $foo='abc def';my @foo=split m/ /,$foo; say for @f +oo" abc def
A lot more by using the string constant directly in the only place it is used:
C:\test>perl -E "my @foo=split m/ /,'abc def'; say for @foo" abc def
And finally, do away with the variables completely:
C:\test>perl -E "say for split m/ /,'abc def'" abc def
|
|---|