#!/usr/bin/perl my $list = './argslist'; # test file of args my @argstomatch = ('--hack','--and','--pray','--elephants'); my $srvr; open (FILE, "<$list") or die "open $list failed: $!\n"; for(){$srvr .= $_}; # append all lines together close (FILE); # at this point we are done collecting - everything is in one $srvr string # the rest demonstrates index for $argfindme(@argstomatch) { printf ("%s\t%s\n", $argfindme, index($srvr,$argfindme)); }