Re: wildcards in perl

2001-12-17 Thread Michael R. Wolf
[EMAIL PROTECTED] writes: > > "Michael R. Wolf" <[EMAIL PROTECTED]> said: > > > Since <> is used so often in a while loop to mean the > > diamond operator, I prefer to spell out "glob" as follows. > > > > > > while (glob "sn.") { > > print "$_\n"; > > } > > > > Just a *preference*. T

Re: wildcards in perl

2001-12-17 Thread Jenda Krynicky
Michael Pratt asked: > How can I open several files with this format sn..txt where > is 0001 0002 so on and so on? > Since noone else suggested it : opendir DIR, $dir; while ($file = readdir DIR) { next if $file !~ /^sn\.\d\d\d\d\.txt$/i;

Re: wildcards in perl

2001-12-16 Thread smoot
> "Michael R. Wolf" <[EMAIL PROTECTED]> said: > Since <> is used so often in a while loop to mean the > diamond operator, I prefer to spell out "glob" as follows. > > > while (glob "sn.") { > print "$_\n"; > } > > Just a *preference*. They're both *right*. I agree. Your way is som

Re: wildcards in perl

2001-12-16 Thread Michael R. Wolf
[EMAIL PROTECTED] writes: > You can use the globbing (shell pattern matching) magic of the <> > operator to get the names of the files. Try this to see how it works. NB: Did you notice that "glob" is sometimes spelled "<>"? It's easy to miss. "<>" in the following example is glob, *not* (did

Re: wildcards in perl

2001-12-16 Thread smoot
> "Michael Pratt" <[EMAIL PROTECTED]> said: > How can I open several files with this format sn..txt where is 0001 > 0002 so on and so on? You can use the globbing (shell pattern matching) magic of the <> operator to get the names of the files. Try this to see how it works. while () {

Re: wildcards in perl

2001-12-16 Thread Jeff 'japhy' Pinyan
On Dec 15, Michael Pratt said: >How can I open several files with this format sn..txt where is >0001 0002 so on and so on? Use a glob, and use Perl's @ARGV magic: { local @ARGV = glob "sn..txt"; while (<>) { # opening each file from @ARGV, one at a time # $ARG

wildcards in perl

2001-12-15 Thread Michael Pratt
How can I open several files with this format sn..txt where is 0001 0002 so on and so on? Thanks! Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]