HEREDOC tricks, etc.

HEREDOC tricks, etc.

am 28.10.2007 22:13:50 von rvtol+news

# does Perl need a qs-operator?
perl -wle '
my $s = join $", qw<
ab
cde
f
ghijk
>;

print $s;
'
ab cde f ghijk


# bash -HEREDOC alike:
perl -wle'
(my $s = < ab
cde
f
ghijk
EOS

print $s;
'
ab
cde
f
ghijk


# qw-emulation
perl -wle'
my @s = split " ", < ab
cde
f
ghijk
EOS

print "<$_>" for @s;
'





(the above occurences of < production code)

--
Affijn, Ruud

"Gewoon is een tijger."