I was under the impression that the reason for using
"my" to declare a variable was to make it act like a
local variable in a sub-routine or loop. Once you
leave the sub or loop, the variable ceases to exist,
thus making your script more efficient, easier to
debug, and more flexible.
But, I have yet to understand what the benefit of
using my on, what I would consider to be, "global"
variables. Won't the vars in the "main" part of the
script get destroyed upon completion?
Alas...I suppose some caring person may wish to impart
this knowledge to me. :)
> Your technique is not something to pass on IMHO.
> A couple of changes may be appropriate or necessary:
>
> use strict;
>
> > opendir LD,".\";
>
> opendir LD, '.' or die "Error on opendir: $!\n"; #
>
> > @files = readdir LD;
>
> my @files = readdir LD;
>
> > closedir LD;
> >
> > $y = 0;
>
> my $y = 0;
> my $new_file = '';
>
> > foreach $f (@files) {
>
> foreach my $f (@files) {
>
> next if $f !~ /^www\d+\.txt$/; # drop non-conforming files
>
> >
>($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
> > = stat($f);
>
> my $mtime = (stat $f)[9]; # much simpler
>
> > if($mtime > $y && -f $f) {
> > $new_file = $f;
> > $y = $mtime
> > }
> > }
> > print("$new_file\n");
>
> Now you can copy it to the new dir.
>
> --
> ,-/- __ _ _ $Bill Luebkert ICQ=14439852
> (_/ / ) // // DBE Collectibles http://www.wgn.net/~dbe/
> / ) /--< o // // Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
> -/-' /___/_<_</_</_ http://www.freeyellow.com/members/dbecoll/
>
> ---
> You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
> To unsubscribe, forward this message to
> [EMAIL PROTECTED]
> For non-automated Mailing List support, send email to
> [EMAIL PROTECTED]
--
-------- Aaron Rainwater ---------
| Only two things are infinite: |
| the universe & stupidity... |
| I'm not sure about the former. |
| ~ Albert Einstein |
----------------------------------
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]