File: lines.pl

package info (click to toggle)
libsystem-command-perl 1.07-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 144 kB
  • sloc: perl: 170; makefile: 2
file content (13 lines) | stat: -rwxr-xr-x 290 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!perl
use strict;
use warnings;

my @fh = map { [ $_ => \do { my $ln = 1 } ] } qw( STDOUT STDERR );

for my $lines (@ARGV) {
    no strict 'refs';
    push @fh, [ my ( $nm, $ln ) = @{ shift @fh } ];
    my $fh = \*$nm;
    print $fh join '', $nm, ' line ', $$ln++, "\n" while $lines--;
}