@cache = `cat filelist`; foreach $path (@cache) { open F, $path; while () { if (/hostname ([\-\w]+)/) { $hostname = $1; last; } } print "$hostname\n"; } #### ================ SmallProf version 0.9 ================ Profile of prof Page 1 ================================================================= count wall tm cpu time line 0 0.000000 0.000000 1:#!/opt/CSCOpx/bin/perl 0 0.000000 0.000000 2: 1 0.000004 0.000000 3:$RUNDIR = "/var/adm/links/newrun"; 0 0.000000 0.000000 4: 0 0.000000 0.000000 5: 1 0.013885 0.010000 6:@cache = `cat $RUNDIR/filelist`; 0 0.000000 0.000000 7: 11600 0.059747 0.050000 8:foreach $path (@cache) { 11599 0.906185 0.080000 9: open F, $path; 284014 3.008497 1.210000 10: while () { 283652 3.195402 0.840000 11: if (/hostname ([-\w]+)/) { 11599 0.101677 0.060000 12: $hostname = $1; 11599 0.094969 0.040000 13: last; 0 0.000000 0.000000 14: } 0 0.000000 0.000000 15: } 11599 0.127013 0.050000 16: print $hostname." "; 0 0.000000 0.000000 17:}