On Jul 11, Håkan Edman said:
>So basically my problem is how do you open a file with a 'wildcard' like
>in my example?
>ex.
>open (INPUT, "xyz_\*") || die print "Couldn't open file...!\n";
First, * does not need to be backslashed in a string -- no need to be so
paranoid about "special" characters.
Second, you probably want to glob():
while (glob "xyz_*") {
open FILE, $_ or die "can't read "$_: $!";
# do stuff with FILE
close FILE;
}
Or use the magic of @ARGV:
{
local @ARGV = glob "xyz_*";
while (<>) {
# do stuff with each line of the file(s)
}
}
Notice that glob() returns ONE filename at a time when called in scalar
context (like $x = glob(...) or while (glob(...))) but all of them when
called in list context (like @files = glob(...)).
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **