... I never seen fat comma (=>) used in join. Is this because we wanted the $sep to be quoted and fat comma will do that for us?
In this case, use of the fat comma is a personal notational convention. $sep is already 'quoted'; that is to say, it is already a string, and there's nothing you could do to make it stringier. If it had been a bareword instead (and assuming strictures and warnings enabled), use of a fat comma would have caused the bareword to be treated as a string.
c:\@Work\Perl\monks>perl -wMstrict -le "my $s = join foo => 1, 2, 3, 4; print qq{'$s'}; " '1foo2foo3foo4'
In fact, any legal expression will be 'stringized' for use by join:
c:\@Work\Perl\monks>perl -wMstrict -le "my $s = join 8, qw(foo bar baz); print qq{'$s'}; " 'foo8bar8baz'
In reply to Re^3: Print something when key does not exist
by AnomalousMonk
in thread Print something when key does not exist
by jaypal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |