Skip to content

Instantly share code, notes, and snippets.

@antmd
Created January 9, 2011 13:32
Show Gist options
  • Save antmd/771683 to your computer and use it in GitHub Desktop.
Save antmd/771683 to your computer and use it in GitHub Desktop.
Perl starter for iterating over a file from either a supplied filename or stdin
#!/usr/bin/perl -w
use strict;
my $input = *STDIN;
if(scalar @ARGV) {
open(FH,$ARGV[0]);
$input = *FH;
}
my $indentLevel=0;
while (<$input>)
{
chomp;
my $line = $_;
print "$line \n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment