In your first example, you grep all of your "large" files, and then use only the first result. How many large files are you opening unnecessarily?
How does this compare:
my $hba_alias = `for f in $switchdir/*.swc ; do grep $host_hi \$f & +& break; done |grep ": device-alias"`;
That's analogous to graff's last if $hba_alias;
In reply to Re: grep equivalent in perl
by hbm
in thread grep equivalent in perl
by shynee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |