HEREDOC tricks, etc.



# 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 = <<EOS) =~ s/(^\s+|\s+$)//mg;
ab
cde
f
ghijk
EOS

print $s;
'
ab
cde
f
ghijk


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

print "<$_>" for @s;
'
<ab>
<cde>
<f>
<ghijk>

(the above occurences of <<EOS should better be written as <<'EOS' in
production code)

--
Affijn, Ruud

"Gewoon is een tijger."

.