Created
November 14, 2019 19:56
-
-
Save marked/cdbff3b9e705fb134f783851e072a22f to your computer and use it in GitHub Desktop.
cat text files while showing source's filenames
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use autodie; | |
my @fns = @ARGV; | |
@ARGV = (); | |
foreach my $fn (@fns) { | |
push @ARGV, $fn; | |
while (my $line = <>) { | |
print "$fn: $line"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
marked I talked to Evan before perl mongers, he explained this 'double diamond' (spaceship was a typo) comes from here:
https://metacpan.org/pod/release/SHAY/perl-5.21.10/pod/perl5215delta.pod#New-double-diamond-operator