Reputation: 191
I have this shell script:
eval{print "Just ";} * * {print "Another ";} * * {print "Perl ";} * * {print "Hacker\n";}
and more variants:
@${print "Just ";} * * {print "Another ";} * * {print "Perl ";} * * {print "Hacker\n";}
$${print "Just ";} * * {print "Another ";} * * {print "Perl ";} * * {print "Hacker\n";}
do{print "Just ";} * * {print "Another ";} * * {print "Perl ";} * * {print "Hacker\n";}
$#{print "Just ";} * * {print "Another ";} * * {print "Perl ";} * * {print "Hacker\n";}
What does * *
do? (It also works if I change * *
to & &
.)
Upvotes: 2
Views: 116
Reputation: 98398
The first *
of each pair is multiplication; the second is a glob dereference. So nothing very useful.
With & &
the first is bitwise and and the second is a subroutine dereference (and call). I don't know why using the canonical true value (returned by print) as a code ref and calling it doesn't error; I would have expected &{!0}
to error like &{"1"}
does with Undefined subroutine &main::1
; instead it seems to be a no-op.
Upvotes: 3