Created
January 9, 2011 13:32
-
-
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
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 -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