while (){ # do stuff here } #### open (PATTERN, "<", "$html_dir/$FigFile/$DirFile") or die "Unable to +open pattern file: $1"; #### open my $PATTERN, "<", "$html_dir/$FigFile/$DirFile" or die "Unable to open pattern file: $!"; #### DoSomethingWithFile($PATTERN); #### sub DoSomethingWithFile { my $FH = shift @_; while (){ # do stuff here } }