carlriz has asked for the wisdom of the Perl Monks concerning the following question:
Hey guys, I was reading 'cool uses for perl' and came across some code. What is the '=<<' operator? What is 'eval $begin.$content;' (specifically, you can concat. these?)? Just curious how this works (maybe the rest of the code too).
my $file = $ARGV[0]; my $content = do { open my $fh, '<', $file or die $!; local $/; <$fh> +}; my $begin =<<'THEEND'; UNITCHECK { no strict; # access $VERSION by symbolic reference no warnings qw (uninitialized); print map { s!/!::!g; s!.pm$!!; sprintf "%-20s %s\n", $_, ${"${_}::VERSION"} } sort keys %INC; exit; }; THEEND eval $begin.$content; print $@ if $@;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hacking Perl Code
by choroba (Cardinal) on Apr 08, 2014 at 20:31 UTC | |
|
Re: Hacking Perl Code
by kcott (Archbishop) on Apr 08, 2014 at 20:35 UTC | |
|
Re: Hacking Perl Code
by LanX (Saint) on Apr 08, 2014 at 21:03 UTC | |
by Discipulus (Canon) on Apr 09, 2014 at 07:49 UTC | |
by LanX (Saint) on Apr 09, 2014 at 10:48 UTC | |
by Discipulus (Canon) on Apr 09, 2014 at 11:39 UTC | |
by LanX (Saint) on Apr 09, 2014 at 17:06 UTC | |
| |
|
Re: Hacking Perl Code
by Anonymous Monk on Apr 08, 2014 at 20:34 UTC | |
by carlriz (Beadle) on Apr 09, 2014 at 13:50 UTC | |
|
Re: Hacking Perl Code (Deparse ppi_dumper perldoc)
by Anonymous Monk on Apr 08, 2014 at 20:38 UTC | |
by Anonymous Monk on Apr 08, 2014 at 20:41 UTC | |
by carlriz (Beadle) on Apr 08, 2014 at 20:40 UTC |