Skip to content

Instantly share code, notes, and snippets.

@marked
Created November 14, 2019 19:56
Show Gist options
  • Save marked/cdbff3b9e705fb134f783851e072a22f to your computer and use it in GitHub Desktop.
Save marked/cdbff3b9e705fb134f783851e072a22f to your computer and use it in GitHub Desktop.
cat text files while showing source's filenames
#!/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";
}
}
@marcopolo4k
Copy link

marcopolo4k commented Nov 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment