Re: AARGHHH,..... chdir(yes - no)

2002-02-12 Thread david wright
ntered the path. Thanks again. :-) On Tuesday, February 12, 2002, at 08:50 AM, Bob Showalter wrote: >> -Original Message- >> From: david wright [mailto:[EMAIL PROTECTED]] >> Sent: Monday, February 11, 2002 9:02 PM >> To: [EMAIL PROTECTED] >> Subject: AARGHHH,.

Re: AARGHHH,..... chdir(yes - no)

2002-02-12 Thread david wright
Sean wrote: "I've been trying to wrap my brain around this for a little while, and I don't think I've been completely successful, but here's my stab at what's wrong. You stated, I think, that line 27 worked and line 29 did not. Line 27 was properly escaped... > 27 #chdir("/Volu

re: time question

2002-02-05 Thread david wright
Hi All, How can I check if directory is older then X days/hours thanks Amit run from command line. perl -e 'print (-M "directory")' - M, Returns the age of OPERAND in days when the program started.

re: simple question

2002-02-04 Thread david wright
Stuart Clark wrote: >How do I replace the letter M with 20 spaces. > >s/M/\s[20]/; # dosen't seem to work :-( > >Regards >Stuart Clark here's my 10c answer ;-) it seems that a tab \t eq 5 spaces. s/M/\t\t\t\t/;

RE: Why localize $_, was-> Re: why shift @_ ?

2002-02-04 Thread david wright
$var = 42; dosomething($var); sub dosomething { local ($var) = @_; &dosomethingelse; print "\$var is now $var\n"; } sub dosomethingelse { $var++; } Using local, you will print 43. If you change local to my, you will get 42. local makes a variabl

Why localize $_, was-> Re: why shift @_ ?

2002-02-04 Thread david wright
Bompa wrote: "I wrote a script to demonstrate how the value of $_ could get changed unexpectedly. (It took me an hour, but I learned from it, heh). use strict; our @list = qw(a b c d); foreach (@list) { &check_b; print $_, "\n"; } sub check_b { foreach (@list) { #local $_; $

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()

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

file test doesn't seem to be working

2002-02-04 Thread david wright
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 directory (folder) i am testing i

re: why shift @_ ?

2002-02-03 Thread david wright
> I have seen Ex #1 "corrected" (as being more well written) to Ex #2. > In this case it is just being passed a $ but the data being passed was > irrelevant. (though not a ref) I still don't see why, i guess i don't > fully understand "shift". Any light shedder's appreciated, thanks : -) > >

re: wildcard for unix???

2002-02-03 Thread david wright
LH wrote: "What is the global wildcard for unix? I'm trying to chmod 755 all files in a dir... possible? chmod 755 *.* ? Thanks LH ahh, so close chmod 775 * -dw5

why shift @_ ?

2002-02-03 Thread david wright
I have seen Ex #1 "corrected" (as being more well written) to Ex #2. In this case it is just being passed a $ but the data being passed was irrelevant. (though not a ref) I still don't see why, i guess i don't fully understand "shift". Any light shedder's appreciated, thanks : -) EX #1: sub ma

Re: counting the recurrence of lines - du-oh,...

2002-02-02 Thread david wright
excellent, thanks for two great answers. I actually tried (! defined) but i tried it on @storeList=; which did not produce the desired results at all : -( John wrote: "The reason you are getting the warnings is because of $saveNum{$dup} on the right hand side of the expression. Use either: $

counting the recurrence of lines - du-oh,...

2002-02-02 Thread david wright
I'm trying to count the recurrence of lines in a file. This works how i want but first it prints "Use of uninitialized,... " - see below. I know i'm probably not supposed to use a hash like this but it does work. I either need another "error free" way to do this or a fix. I have figures

Re: one question to end the day on . . .

2002-02-02 Thread david wright
Timothy B wrote: "Hello out there - I have learned a lot of Perl today, but I am still trying to figure one more thing out. How can I go through a file and extract all the text between certain delimiters - for example I have: Bilbo, "Why I like rings" Freemont Press, 1998. Frodo, "Why I don't" B

counting the recurrence of lines - du-oh,...

2002-02-02 Thread david wright
> > I'm trying to count the recurrence of lines in a file. This works > how i want but first it prints "Use of uninitialized,... " - see below. > I know i'm probably not supposed to use a hash like this but it does > work. I either need another "error free" way to do this or a fix. I > h