my $file = $ARGV[0] || 'targets.txt'; open (INPUT, '<', $file) or die "Unable to open $file for reading : $!"; while ( ) { chomp; get_three( $_ ); # used your sub/calling convention }