Re: file test doesn't seem to be working

2002-02-05 Thread John Mooney
>>> "Brett W. McCoy" <[EMAIL PROTECTED]> 2/5/2002 10:35:48 AM >>> > >That's just more a matter of style -- I get the willies when subroutines >modify global values invisibly. Great advice. thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: file test doesn't seem to be working

2002-02-05 Thread Brett W. McCoy
On Tue, 5 Feb 2002, John Mooney wrote: > Actually, it is not an incorrect way I believe, so much as he is using > slightly incorrect syntax. From the Nutshell ... I really meant 'incorrect' in its usage, not the syntax -- he was using it in a void context. > ... I think the key is that he was

Re: file test doesn't seem to be working

2002-02-05 Thread John Mooney
>>> "Brett W. McCoy" <[EMAIL PROTECTED]> 2/4/2002 9:28:42 PM >>> >>On Mon, 4 Feb 2002, david wright wrote: >> >> i can't use the ternary operator like this? (damn waste if not) thanks. >> >> foreach $dup (@array){ >> (-d $dup) ? print "yes: $dup \n": print "no: $dup \n"; >> ) > >Yes, that i

Re: file test doesn't seem to be working

2002-02-04 Thread Jeff 'japhy' Pinyan
On Feb 4, Brett W. McCoy said: >On Mon, 4 Feb 2002, david wright wrote: > >> i can't use the ternary operator like this? (damn waste if not) thanks. >> >> foreach $dup (@array){ >> (-d $dup) ? print "yes: $dup \n": print "no: $dup \n"; >> ) > >Yes, that is an incorrect way to use the ?: op

Re: file test doesn't seem to be working

2002-02-04 Thread Brett W. McCoy
On Mon, 4 Feb 2002, david wright wrote: > i can't use the ternary operator like this? (damn waste if not) thanks. > > foreach $dup (@array){ > (-d $dup) ? print "yes: $dup \n": print "no: $dup \n"; > ) Yes, that is an incorrect way to use the ?: operator -- the operataor is handed an expr

Re: file test doesn't seem to be working

2002-02-04 Thread John W. Krahn
David Wright wrote: > > i am sending @array a directory (i.e. example /usr/dw5) which contains a > lot of files and folders (directories). > (i have already checked the value of @array and $dup and they are as > desired.) What i want to accomplish is: print yes, "$dup (file name)" if > it's a dir

Re: file test doesn't seem to be working

2002-02-04 Thread david wright
On Monday, February 4, 2002, at 07:26 PM, Jeff 'japhy' Pinyan wrote: > On Feb 4, david wright said: > >> i am sending @array a directory (i.e. example /usr/dw5) which >> contains a >> lot of files and folders (directories). > > Be warned that readdir() returns NAMES, not PATHS. > > opendir DI

Re: file test doesn't seem to be working

2002-02-04 Thread Jeff 'japhy' Pinyan
On Feb 4, david wright said: >i am sending @array a directory (i.e. example /usr/dw5) which contains a >lot of files and folders (directories). Be warned that readdir() returns NAMES, not PATHS. opendir DIR, "/some/dir"; @files = readdir DIR; closedir DIR; @files will contain (".", ".."

Re: file test doesn't seem to be working

2002-02-04 Thread david wright
On Monday, February 4, 2002, at 06:57 PM, Timothy Johnson wrote: > > Did you chdir to the directory? Otherwise your script might be > checking the > wrong directory. > > opendir(DIR,"/mydir"); > @array = readdir(DIR); > chdir "/mydir"; > foreach $dup (@array){ > (-d $dup) ? print "yes: $d

RE: file test doesn't seem to be working

2002-02-04 Thread Timothy Johnson
Did you chdir to the directory? Otherwise your script might be checking the wrong directory. opendir(DIR,"/mydir"); @array = readdir(DIR); chdir "/mydir"; foreach $dup (@array){ (-d $dup) ? print "yes: $dup \n": print "no: $dup \n"; } -Original Message- From: david wright [mailt