using file globs and regex
- From: pgodfrin <pgodfrin@xxxxxxxxx>
- Date: Fri, 7 Aug 2009 09:33:52 -0700 (PDT)
Greetings,
This program works fine (with file names f1..f8 in the directory):
#!/usr/bin/perl
use warnings;
use strict;
$\="\n";
while(<f*>)
{
print "$_";
if(/f5/)
{
my $fn=$_;
print "File name $fn found..." and exit;
}
}
exit;
But I was hoping to be able to do something like:
my $fn=grep (/f5/,<f*>);
Basically just trying to have less lines of code...any suggestions?
phil g
.
- Follow-Ups:
- Re: using file globs and regex
- From: Tad J McClellan
- Re: using file globs and regex
- Prev by Date: Re: Perl process as a unix background process
- Next by Date: Re: Perl process as a unix background process
- Previous by thread: Perl process as a unix background process
- Next by thread: Re: using file globs and regex
- Index(es):
Relevant Pages
|