Re: File::Find .. still confused slightly

2017-07-05 Thread Harry Putnam
rea...@newsguy.com (Harry Putnam) writes: > What surprised me is the that when I ran them prefaced with the `time' > utility, I see the sloppy mess I wrote is nearly twice as fast. I may have found a reason. in the find sub {} part you did two returns return unless -f; return un

Re: File::Find .. still confused slightly

2017-07-05 Thread Harry Putnam
jimsgib...@gmail.com (Jim Gibson) writes: > You have a logic error in your code somewhere. Your logic for counting > the files with a name matching a certain pattern is too complicated to > follow and point out where your error lies and how to fix it. The > basic problem is that your logic depends

Re: File::Find .. still confused slightly

2017-07-05 Thread Jim Gibson
You have a logic error in your code somewhere. Your logic for counting the files with a name matching a certain pattern is too complicated to follow and point out where your error lies and how to fix it. The basic problem is that your logic depends upon detecting when the directory name changes,

Re: File::Find report file count per directory

2017-06-28 Thread Harry Putnam
jimsgib...@gmail.com (Jim Gibson) writes: [...] > I don’t see how the code you have posted can possibly produce the > output you have reported. The code above looks like error checking > that the user of the program has entered one argument, and that > argument is the name of a directory. Egad,

Re: File::Find report file count per directory

2017-06-28 Thread Harry Putnam
jimsgib...@gmail.com (Jim Gibson) writes: [...] > I don’t see how the code you have posted can possibly produce the > output you have reported. The code above looks like error checking > that the user of the program has entered one argument, and that > argument is the name of a directory. Egad,

Re: File::Find report file count per directory

2017-06-28 Thread Jim Gibson
On Jun 28, 2017, at 2:10 PM, Harry Putnam wrote: > > 1) I want to count numeric named files in each directory. > > 2) I want to capture the name of the directory those files are in > > 3) I want to print the directory name and the count (if any) for each > directory. > > I know that all the i

Re: File:: Find help

2013-01-10 Thread punit jain
I think the issue is as you mentioned exporting find from File::Find::Rule. However File::Find I am not sure I will get that flexibility to search only 1 level depth. On Thu, Jan 10, 2013 at 6:07 PM, David Precious wrote: > On Thu, 10 Jan 2013 17:56:18 +0530 > punit jain wrote: > > > I need to

Re: File:: Find help

2013-01-10 Thread John W. Krahn
punit jain wrote: Hi, Hello, I have a requirement where I have directory structure like : - test --> test/user1/files/, test/user2/files/, test/user3/files/ etc. under sub-directories with usernames I have file with name usersettings. So the final structure as : - test / user1 / usersett

Re: File:: Find help

2013-01-10 Thread David Precious
On Thu, 10 Jan 2013 17:56:18 +0530 punit jain wrote: > I need to get all the subdirectories of test and then read the file > usersettings under that later on to do some processing. I wrote code > below :- > #!/usr/bin/perl > use strict; > use warnings; > use File::Basename qw(basename dirname); >

Re: File::Find::Object::Rule problem

2012-04-23 Thread Shlomi Fish
ׁHi Manfred, On Mon, 23 Apr 2012 12:24:49 +0200 Manfred Lotz wrote: > On Mon, 23 Apr 2012 11:01:33 +0300 > Shlomi Fish wrote: > > > Hi all, > > > > On Mon, 23 Apr 2012 10:12:33 +0300 > > Shlomi Fish wrote: > > > > > Hi Jack, > > > > > > On Mon, 23 Apr 2012 06:02:55 + > > > Jack Maney

Re: File::Find::Object::Rule problem

2012-04-23 Thread Manfred Lotz
On Mon, 23 Apr 2012 06:02:55 + Jack Maney wrote: > Manfred, > > The issue is that you're storing the return value of the start method > into $plf, and if you look at the source code, the start method > returns 1. > > In fact, using Data::Dumper, > > print Dumper($plf) . "\n"; > > returns

Re: File::Find::Object::Rule problem

2012-04-23 Thread Manfred Lotz
On Mon, 23 Apr 2012 11:01:33 +0300 Shlomi Fish wrote: > Hi all, > > On Mon, 23 Apr 2012 10:12:33 +0300 > Shlomi Fish wrote: > > > Hi Jack, > > > > On Mon, 23 Apr 2012 06:02:55 + > > Jack Maney wrote: > > > > > Manfred, > > > > > > The issue is that you're storing the return value of th

Re: File::Find::Object::Rule problem

2012-04-23 Thread Shlomi Fish
Hi all, On Mon, 23 Apr 2012 10:12:33 +0300 Shlomi Fish wrote: > Hi Jack, > > On Mon, 23 Apr 2012 06:02:55 + > Jack Maney wrote: > > > Manfred, > > > > The issue is that you're storing the return value of the start method into > > $plf, and if you look at the source code, the start metho

Re: File::Find::Object::Rule problem

2012-04-23 Thread Shlomi Fish
Hi Jack, On Mon, 23 Apr 2012 06:02:55 + Jack Maney wrote: > Manfred, > > The issue is that you're storing the return value of the start method into > $plf, and if you look at the source code, the start method returns 1. > > In fact, using Data::Dumper, > > print Dumper($plf) . "\n"; >

RE: File::Find::Object::Rule problem

2012-04-22 Thread Jack Maney
Manfred, The issue is that you're storing the return value of the start method into $plf, and if you look at the source code, the start method returns 1. In fact, using Data::Dumper, print Dumper($plf) . "\n"; returns $VAR1 = 1; The start method is a method that doesn't return anything impo

Re: File::Find script questions

2011-07-19 Thread Uri Guttman
> "M" == Marc writes: M>Thanks to both Uri and John for their input. I've added your suggestions and the script is much cleaner and more concise now. M>I decided to keep the header info in the sub because I'm now setting the subject to the path of the error log, so at a glance

Re: File::Find script questions

2011-07-19 Thread Marc
Thanks to both Uri and John for their input. I've added your suggestions and the script is much cleaner and more concise now. I decided to keep the header info in the sub because I'm now setting the subject to the path of the error log, so at a glance I know where there's a pro

Re: File::Find script questions

2011-07-18 Thread Uri Guttman
> "M" == Marc writes: M>The script works great but I'd like to get advice on how I can M>clean up my code, so any comments are welcome. M>Also, do I really need the foreach block in there? I couldn't M>get it to work without it, but it seems like I should be able

Re: File::Find script questions

2011-07-18 Thread Uri Guttman
> "HW" == Hal Wigoda writes: HW> Why clean it up when it works and is not obfusticating. because he asked for comments and it will be educational to all on the list. uri -- Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com -- Perl Developer Recruit

Re: File::Find script questions

2011-07-18 Thread John W. Krahn
Marc wrote: I've written a script to traverse my web server, find any files called "error_log", e-mail them to me, and then delete them. It is triggered by cron twice a day. The script works great but I'd like to get advice on how I can clean up my code, so any comments are welcome. Also, do I

Re: File::Find script questions

2011-07-18 Thread Hal Wigoda
Why clean it up when it works and is not obfusticating. On Mon, Jul 18, 2011 at 8:59 PM, Marc wrote: >        I've written a script to traverse my web server, find any files called > "error_log", e-mail them to me, and then delete them.  It is triggered by > cron twice a day. > >        The scr

Re: File::Find usage

2010-07-24 Thread John W. Krahn
Unknown User wrote: I have this script to find out where a perl module is on my machine: [unkn...@knowme:~/bin]$ cat findmodule #!/usr/bin/perl -w use File::Find; use strict; if ($ENV{"INC"} ) { # INC=PATH1:PATH2 ./getmodule perldoc perlrun [ SNIP ] PERL5LIBA list

Re: File::Find and top level directory

2010-04-25 Thread Shlomi Fish
On Saturday 24 Apr 2010 22:00:56 Harry Putnam wrote: > When using File::Find; > Is there any built in way to know when you are in the top level of one > of the directories in @directories? > > I mean besides grepping $File::Find::dir. > > I know that give the current directory name and of course

Re: File::Find NO RECURSION Howto

2010-03-03 Thread Shlomi Fish
On Monday 01 Mar 2010 19:31:15 Shawn H Corey wrote: > Shlomi Fish wrote: > > Well, Matt S. Trout shared his sentiments about "I cannot use CPAN" here: > > > > http://www.shadowcat.co.uk/blog/matt-s-trout/but-i-cant-use-cpan/ > > Well, Matt is wrong. You can't always use CPAN. Yes, you can set i

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shawn H Corey
Shlomi Fish wrote: > Well, Matt S. Trout shared his sentiments about "I cannot use CPAN" here: > > http://www.shadowcat.co.uk/blog/matt-s-trout/but-i-cant-use-cpan/ > Well, Matt is wrong. You can't always use CPAN. Yes, you can set it up so you can use it in development, but that doesn't mean

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shlomi Fish
On Monday 01 Mar 2010 15:00:26 raphael() wrote: > On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey wrote: > > raphael() wrote: > > > Hi, > > > > > > How can I stop File::Find to go below current dir? i.e. no recursion. > > > > > > Although I can use glob or <*> to get file names in current dir. > >

Re: File::Find NO RECURSION Howto

2010-03-01 Thread raphael()
On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey wrote: > raphael() wrote: > > Hi, > > > > How can I stop File::Find to go below current dir? i.e. no recursion. > > > > Although I can use glob or <*> to get file names in current dir. > > But I wanted to know if File::Find has a maxdepth limit like l

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shlomi Fish
On Monday 01 Mar 2010 13:23:16 raphael() wrote: > Hi, > > How can I stop File::Find to go below current dir? i.e. no recursion. > > Although I can use glob or <*> to get file names in current dir. > But I wanted to know if File::Find has a maxdepth limit like linux "find". > Not, by itself, but

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shawn H Corey
raphael() wrote: > Hi, > > How can I stop File::Find to go below current dir? i.e. no recursion. > > Although I can use glob or <*> to get file names in current dir. > But I wanted to know if File::Find has a maxdepth limit like linux "find". > > The script I created uses a switch which decides

Re: File::Find with chmod trouble debugging

2009-07-08 Thread Harry Putnam
Telemachus writes: > On Mon Jul 06 2009 @ 3:31, Harry Putnam wrote: >> Thanks to all ... >> Now I'm curious about something else: >> >> Is the mode in a stat(file) readout something still different >> than octal or decimal? > > As John answered, there's more there than just the permissions. If

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Telemachus
On Mon Jul 06 2009 @ 3:31, Harry Putnam wrote: > Thanks to all ... > Now I'm curious about something else: > > Is the mode in a stat(file) readout something still different > than octal or decimal? As John answered, there's more there than just the permissions. If you check perldoc -f stat, ther

Re: File::Find with chmod trouble debugging

2009-07-06 Thread John W. Krahn
Harry Putnam wrote: Thanks to all ... Now I'm curious about something else: Is the mode in a stat(file) readout something still different than octal or decimal? I see `33261' show up in the `mode' slot on a file with 755 permissions (from perldoc -f stat: [...] ($dev,$ino,$mode,$nli

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Harry Putnam
Thanks to all ... Now I'm curious about something else: Is the mode in a stat(file) readout something still different than octal or decimal? I see `33261' show up in the `mode' slot on a file with 755 permissions (from perldoc -f stat: [...] ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$si

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Telemachus
On Mon Jul 06 2009 @ 7:00, Harry Putnam wrote: > Can anyone tell me how printing of $mode = 0755 turns into 493? Yup: what's in $mode is an octal number. Its decimal equivalent is 493. What you really want to print out is the string '0755', but the string and the octal number are not the same thi

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Chas. Owens
On Mon, Jul 6, 2009 at 08:00, Harry Putnam wrote: snip > Can anyone tell me how printing of $mode = 0755 turns into 493? snip >  my $mode = 0755; snip >             print "hpdb chmod $mode  $fname\n"; snip 0755 is 493. More specifically they are two representations of the same number: the first i

Re: File::Find

2009-05-19 Thread Randal L. Schwartz
> ""Chas" == "Chas Owens" writes: "Chas> Huh, never looked at File::Finder before, it looks like it would only "Chas> make sense if you already knew the UNIX find command. I normally see "Chas> people use File::Find::Rule when they don't want to write their own "Chas> wanted function. Indee

Re: File::Find

2009-05-18 Thread Greg Eldridge
> > http://search.cpan.org/~tty/kurila-1.19_0/lib/Benchmark.pm > > -- > Ron Bergin Thanks to all for replying. Greg. signature.asc Description: This is a digitally signed message part

Re: File::Find

2009-05-18 Thread Chas. Owens
On Mon, May 18, 2009 at 21:02, Gunnar Hjalmarsson wrote: > AndrewMcHorney wrote: >> >> I am getting totally confused. All I want is a simple find function call >> what will return all the files that are in c:\*.*. > > File::Find is useful for recursive tasks. If all you want is to list the > files

Re: File::Find

2009-05-18 Thread rkb
Greg Eldridge wrote: > On Mon, 2009-05-18 at 17:36 -0700, r...@i.frys.com wrote: > > What Benchmark .pm are you using ? > CPAN i/benchmark/ => lists 66 entries, but none of which are simply > Benchmark > > Thanks in advance. > > Greg. > http://search.cpan.org/~tty/kurila-1.19_0/lib/Benchmark.pm

Re: File::Find

2009-05-18 Thread David Moreno
Greg Eldridge wrote: What Benchmark .pm are you using ? CPAN i/benchmark/ => lists 66 entries, but none of which are simply Benchmark Thanks in advance. http://search.cpan.org/~nwclark/perl-5.8.9/lib/Benchmark.pm -- David Moreno http://twitter.com/damog -- To unsubscribe, e-mail: beginne

Re: File::Find

2009-05-18 Thread Greg Eldridge
On Mon, 2009-05-18 at 17:36 -0700, r...@i.frys.com wrote: > #!/usr/bin/perl > > use strict; > use warnings; > use File::Find; > use Benchmark qw/cmpthese/; > > cmpthese( 10, { > 'dir' => sub {my @files = `dir /b /a-d /s c:\test` }, > > 'filefind' => sub {my @files; >

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
AndrewMcHorney wrote: I am getting totally confused. All I want is a simple find function call what will return all the files that are in c:\*.*. File::Find is useful for recursive tasks. If all you want is to list the files in one directory, there are simpler ways. Personally I would use ope

Re: File::Find

2009-05-18 Thread Chas. Owens
On Mon, May 18, 2009 at 20:36, wrote: > Chas. Owens wrote: >> On Mon, May 18, 2009 at 19:41, AndrewMcHorney wrote: >>> Charles >>> >>> I am getting totally confused. All I want is a simple find function call >>> what will return all the files that are in c:\*.*. This is on PC running >>> windows

Re: File::Find

2009-05-18 Thread rkb
Chas. Owens wrote: > On Mon, May 18, 2009 at 19:41, AndrewMcHorney wrote: >> Charles >> >> I am getting totally confused. All I want is a simple find function call >> what will return all the files that are in c:\*.*. This is on PC running >> windows. I thought you mentioned to use file:find() whe

Re: File::Find

2009-05-18 Thread David Moreno
AndrewMcHorney wrote: Charles I am getting totally confused. All I want is a simple find function call what will return all the files that are in c:\*.*. This is on PC running windows. I thought you mentioned to use file:find() where one of the parameters would be a function which would be ca

Re: File::Find

2009-05-18 Thread Chas. Owens
On Mon, May 18, 2009 at 19:41, AndrewMcHorney wrote: > Charles > > I am getting totally confused. All I want is a simple find function call > what will return all the files that are in c:\*.*. This is on PC running > windows. I thought you mentioned to use file:find() where one of the > parameters

Re: File::Find

2009-05-18 Thread AndrewMcHorney
Charles I am getting totally confused. All I want is a simple find function call what will return all the files that are in c:\*.*. This is on PC running windows. I thought you mentioned to use file:find() where one of the parameters would be a function which would be called once for each fil

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson wrote: AndrewMcHorney wrote: I looked at the documentation for this function and I find it confusing. Try File::Finder for a less confusing interface to *the module* File::Find. snip Huh, never looked at File::Finder befor

Re: File::Find

2009-05-18 Thread Chas. Owens
On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson wrote: > AndrewMcHorney wrote: >> >> I looked at the documentation for this function and I find it confusing. > > Try File::Finder for a less confusing interface to *the module* File::Find. snip Huh, never looked at File::Finder before, it looks l

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
AndrewMcHorney wrote: I looked at the documentation for this function and I find it confusing. Try File::Finder for a less confusing interface to *the module* File::Find. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl

Re: File::Find

2009-05-18 Thread Chas. Owens
On Mon, May 18, 2009 at 18:40, AndrewMcHorney wrote: > Hello > > I looked at the documentation for this function and I find it confusing. > What do you pass in to get all the files on drive letter c? snip find \&wanted, "c:/"; will run the wanted function once for every file and directory on the

Re: file::find skip subdir

2009-01-12 Thread Chas. Owens
On Mon, Jan 12, 2009 at 16:05, icarus wrote: > I'm trying to all count files in a home dir and all subdirs *except* a > subdir called 'backup'. When you run into the condition where you don't want to recurse further, set $File::Find::prune to 1 (e.g. $File::Find::prune = 1 if $_ = "./backup";).

Re: file::find

2008-01-04 Thread John W. Krahn
oryann9 wrote: Perl'ers, I was going to reply but I see that this is also posted to PerlMonks. :( John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscri

Re: file::find

2008-01-04 Thread Tom Phoenix
On Jan 4, 2008 12:33 PM, oryann9 <[EMAIL PROTECTED]> wrote: > if ( $fs =~ m|\x2f{1}?|g ) { ##-- if "/" is matched --# That's a pretty hard way to write the pattern m#/#. And it's wrong, too, since you have a /g modifier on it. Or maybe I'm misunderstanding what you're doing. Did you mean to use

Re: File::Find::name output

2007-12-04 Thread Randal L. Schwartz
> "reader" == reader <[EMAIL PROTECTED]> writes: reader> I was using `use Cwd 'abs_path'; at first but someone said it reader> shouldn't be necessary... turns out it is, unless user gives absolute reader> names to File::Find. Apparently because File::Find cds to source reader> directories to

Re: File::Find::name output

2007-12-03 Thread reader
[EMAIL PROTECTED] (Randal L. Schwartz) writes: >> "reader" == reader <[EMAIL PROTECTED]> writes: > > reader> The output I'm getting is a relative name, and that is what I've fed > reader> the find function. But still the docu seems to indicate it will > reader> return the absolute (`complete

Re: File::Find::name output

2007-12-03 Thread Randal L. Schwartz
> "reader" == reader <[EMAIL PROTECTED]> writes: reader> The output I'm getting is a relative name, and that is what I've fed reader> the find function. But still the docu seems to indicate it will reader> return the absolute (`complete' as above) file name. No, "complete" is not "absolute"

Re: File::Find::name output

2007-12-02 Thread Tom Phoenix
On 12/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Near as I can tell, when looking at perldoc File::Find > when used as a variable $File::Find::name it supposed to be the > absolute filename > The output I'm getting is a relative name, and that is what I've fed > the find function. But

Re: $File::Find and no_chdir

2007-09-29 Thread Dr.Ruud
schms schreef: > opendir DH, $DIR or die "Cannot open '$DIR' $!"; > print map "$DIR/$_\n", readdir DH; > closedir DH; Looks very 'global variables' oriented to me. Compare to: { opendir my $dh, $dir or die "Cannot open '$dir': $!"; while (my $e = readdir $dh) { $

Re: $File::Find and no_chdir

2007-09-27 Thread schms
On 27 Sep., 15:01, [EMAIL PROTECTED] (Paul Lalli) wrote: > On Sep 27, 6:00 am, [EMAIL PROTECTED] (Schms) wrote: > > > I have a UNIX directory $DIR which contains a lot of files and > > subdirecotires. Now, I would > > > like to list all files and subdirectories in $DIR only. That means, > > $File:

Re: $File::Find and no_chdir

2007-09-27 Thread Paul Lalli
On Sep 27, 6:00 am, [EMAIL PROTECTED] (Schms) wrote: > I have a UNIX directory $DIR which contains a lot of files and > subdirecotires. Now, I would > > like to list all files and subdirectories in $DIR only. That means, > $File::Find should not > > go into any subdirectories of $DIR and list the

Re: $File::Find and no_chdir

2007-09-27 Thread John W. Krahn
schms wrote: Hi, Hello, I have a UNIX directory $DIR which contains a lot of files and subdirecotires. Now, I would like to list all files and subdirectories in $DIR only. That means, $File::Find should not go into any subdirectories of $DIR and list the files and subdirectories there as wel

Re: File::Find

2007-09-01 Thread Somu
Oh, i am very sorry for my mistakes. Actually i write email from my mobile, and somehow that backslash vanished. I just checked now from a PC and its working now. Thanks. And i also commented that line sub rm(); thanks everybody! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: File::Find

2007-09-01 Thread Rob Dixon
Ron Bergin wrote: On Aug 28, 10:10 pm, [EMAIL PROTECTED] (Omega -1911) wrote: Ha! Here is a snippet that I use on a windows machine. It works!!! use File::Find; sub rm(); $count = 0; @directories = ("F://Hindi/RHTDM"); find(\&rm, @directories); sub rm() { $count++; my ($filename) = $_; if ($f

Re: File::Find

2007-09-01 Thread Ron Bergin
On Aug 28, 10:10 pm, [EMAIL PROTECTED] (Omega -1911) wrote: > Ha! Here is a snippet that I use on a windows machine. It works!!! > > use File::Find; > > sub rm(); > $count = 0; > @directories = ("F://Hindi/RHTDM"); > find(\&rm, @directories); > > sub rm() { > $count++; > my ($filename) = $_; > if (

Re: File::Find

2007-09-01 Thread Ron Bergin
On Aug 28, 10:10 pm, [EMAIL PROTECTED] (Omega -1911) wrote: > Ha! Here is a snippet that I use on a windows machine. It works!!! > > use File::Find; > > sub rm(); > $count = 0; > @directories = ("F://Hindi/RHTDM"); > find(\&rm, @directories); > > sub rm() { > $count++; > my ($filename) = $_; > if (

Re: File::Find

2007-08-31 Thread Rob Dixon
Somu wrote: use strict; use warnings; use File::Find; sub rm(); Remove the (). This prototypes the subroutine to force it to have no parameters. sub rm; In fact leaving this line out altogether is probably the best option. The subroutine doesn't need to be declared early. my $count=0; my

Re: File::Find

2007-08-31 Thread Omega -1911
On 8/31/07, Somu <[EMAIL PROTECTED]> wrote: > use strict; > use warnings; > use File::Find; > sub rm(); > my $count=0; > my @dir = ("F://Hindi/RHTDM"); > find(&rm,@dir); > > sub rm(){$count++ > my ($fname)= $_; > if($fname=~ /mp3/){print "$count $fname"} > } PLEASE!!! Before coming to this list an

Re: File::Find

2007-08-31 Thread Somu
Those double dollar signs are formatting errors of my mail server. And with the code i posted, the error has to be at the if statement in the rm definition -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: File::Find

2007-08-31 Thread Somu
use strict; use warnings; use File::Find; sub rm(); my $count=0; my @dir = ("F://Hindi/RHTDM"); find(&rm,@dir); sub rm(){$count++ my ($fname)= $_; if($fname=~ /mp3/){print "$count $fname"} } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://le

Re: File::Find

2007-08-31 Thread Rob Dixon
Somu wrote: It gave the error Use of uninitialized value in pattern match (m//) at test.pl line 13. Can't use string ("") as a subroutine ref while "strict refs" in use at C:/Perl/lib/File/Find.pm line 822. Please show your code. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addition

Re: File::Find

2007-08-31 Thread Omega -1911
On 8/31/07, Somu <[EMAIL PROTECTED]> wrote: > It gave the error > > Use of uninitialized value in pattern match (m//) at test.pl line 13. > Can't use string ("") as a subroutine ref while "strict refs" in use > at C:/Perl/lib/File/Find.pm line 822. > > > ??? > > On 8/29/07, Omega -1911 <[EMAIL PRO

Re: File::Find

2007-08-31 Thread Somu
It gave the error Use of uninitialized value in pattern match (m//) at test.pl line 13. Can't use string ("") as a subroutine ref while "strict refs" in use at C:/Perl/lib/File/Find.pm line 822. ??? On 8/29/07, Omega -1911 <[EMAIL PROTECTED]> wrote: > On 8/28/07, Randal L. Schwartz <[EMAIL PRO

Re: File::Find

2007-08-29 Thread Rob Dixon
Randal L. Schwartz wrote: "Somu" == Somu <[EMAIL PROTECTED]> writes: Somu> Good sense of humour! Actually i wanted to search for F:/Hindi/RHTDM Somu> and i entered only /Hindi/RHTDM/ Why did you do that? I think you have to enter the full path on Windows. However, I don't run Windows (anywh

Re: File::Find

2007-08-28 Thread Omega -1911
On 8/28/07, Randal L. Schwartz <[EMAIL PROTECTED]> wrote: > > "Somu" == Somu <[EMAIL PROTECTED]> writes: > > Somu> Good sense of humour! Actually i wanted to search for F:/Hindi/RHTDM > Somu> and i entered only /Hindi/RHTDM/ > > Why did you do that? I think you have to enter the full path on

Re: File::Find

2007-08-28 Thread Somu
I write all my programs for my personal use in my PC only, just to learn perl. I will use the code again and tell you, Mr.Randal. Thanks anyway. Actually, i have written something which will get all file and folder names in a given folder matching a regex, but then i want the same subroutine to run

Re: File::Find

2007-08-28 Thread Randal L. Schwartz
> "Somu" == Somu <[EMAIL PROTECTED]> writes: Somu> Good sense of humour! Actually i wanted to search for F:/Hindi/RHTDM Somu> and i entered only /Hindi/RHTDM/ Why did you do that? I think you have to enter the full path on Windows. However, I don't run Windows (anywhere!) so I can't actual

Re: File::Find

2007-08-27 Thread Martin Barth
Hi, I dont use perl on windows, so if there are any special things about File::Find your Filesystem I can't help you. Please show us the code you're using to find the files you're looking for. Maybe we have some hints for you. HTH, Martin On Tue, 28 Aug 2007 00:28:40 +0530 Somu <[EMAIL PROTECTE

Re: File::Find

2007-08-27 Thread Somu
Good sense of humour! Actually i wanted to search for F:/Hindi/RHTDM and i entered only /Hindi/RHTDM/ it didnt find anything. When i tried to print the list in which i pushed the $File::Find::name it said use of uninitialised ... Actually i am unable to understand clearly from the docs for File::

Re: File::Find

2007-08-26 Thread Randal L. Schwartz
> "Somu" == Somu <[EMAIL PROTECTED]> writes: Somu> The code didnt work. Error: Somu> Can't stat /my/dir: No such file or directory Somu> at test.pl line 12 Then you don't have "/my/dir". :) I'd actually be surprised if you did. I haven't seen any systems that have /my as a top-level direc

Re: File::Find

2007-08-26 Thread Somu
The code didnt work. Error: Can't stat /my/dir: No such file or directory at test.pl line 12 On 8/20/07, Martin Barth <[EMAIL PROTECTED]> wrote: > On Fri, 17 Aug 2007 07:48:33 -0700 > [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > > > Why not just: > > > > my @list; > > find sub { push @list, $$

Re: File::Find

2007-08-20 Thread Martin Barth
On Fri, 17 Aug 2007 07:48:33 -0700 [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > Why not just: > > my @list; > find sub { push @list, $File::Find::name }, "/var/SAMPLES"; HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org

Re: File::Find help

2007-08-19 Thread [EMAIL PROTECTED]
On Aug 17, 11:45 am, [EMAIL PROTECTED] (Paul Lalli) wrote: > On Aug 16, 7:21 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > > > Paul Lalli wrote: > > > So define the subroutine in the same scope as the array. Move the > > > subroutine into the if-statement as well. > > > Huh? > > What part of

Re: File::Find help

2007-08-18 Thread Randal L. Schwartz
> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes: >> I get it now, I think. I'm not sure why you put "my $i = 5" in there, >> since that's unrelated to the $i of the closure. Chas> The" my $i = 5;" was to show that the two variables named $i were Chas> indeed in different scopes. The expe

Re: File::Find help

2007-08-18 Thread Chas Owens
On 8/18/07, Randal L. Schwartz <[EMAIL PROTECTED]> wrote: > > ""Chas" == "Chas Owens" <[EMAIL PROTECTED]> writes: > > "Chas> { > "Chas> my $i; > "Chas> sub iter { return $i++ } > "Chas> } > > "Chas> my $i = 5; > "Chas> print iter(), "\n"; > "Chas> print iter(), "\n"; > "Chas> pr

Re: File::Find help

2007-08-18 Thread Randal L. Schwartz
> ""Chas" == "Chas Owens" <[EMAIL PROTECTED]> writes: "Chas> { "Chas> my $i; "Chas> sub iter { return $i++ } "Chas> } "Chas> my $i = 5; "Chas> print iter(), "\n"; "Chas> print iter(), "\n"; "Chas> print iter(), "\n"; "Chas> print iter(), "\n"; I get it now, I think. I'm not

Re: File::Find help

2007-08-17 Thread Chas Owens
On 8/17/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip > which still works in Perl 5.8.8, but probably shouldn't. I thought > they were going to fix this after Perl 5.6.1, but apparently it is > still around (or has reemerged). Maybe Perl 6 will finally kill it (I > have to test it in Pugs now).

Re: File::Find help

2007-08-17 Thread Chas Owens
On 8/17/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip > Do you mean "broken" as in it doesn't work, it shouldn't work, or it > is a bad idea? While I think it shouldn't work and it is a bad idea, > it does, much to my surprise when I tested it before posting*, > demonstrably** work with Perl 5.8.

Re: File::Find help

2007-08-17 Thread Chas Owens
On 8/17/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip > warnings pragma). I think it is a variant of the classic obscenity snip > my $var if 0; snip > still around (or has reemerged). Maybe Perl 6 will finally kill it (I > have to test it in Pugs now). snip Pugs prints five zeros, so it

Re: File::Find help

2007-08-17 Thread Randal L. Schwartz
> ""Chas" == "Chas Owens" <[EMAIL PROTECTED]> writes: "Chas> ** here is the example for reference sake. "Chas> #!/usr/bin/perl "Chas> use strict; "Chas> use warnings; "Chas> { "Chas>my $i; "Chas>sub iter { return $i++ } "Chas> } "Chas> my $i = 5; "Chas> print iter(), "\n"; "

Re: File::Find help

2007-08-17 Thread Chas Owens
On 8/17/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip > > see attached. > > And this file was supposed to demonstrate, what, exactly? snip I believe he was trying to demonstrate the "right way" to build an iterator*, as opposed to the example** I used to show that, in fact, a subroutine can be gi

Re: File::Find help

2007-08-17 Thread Paul Lalli
On Aug 17, 11:13 am, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Paul Lalli wrote: > > On Aug 16, 7:21 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > >> Paul Lalli wrote: > >>> So define the subroutine in the same scope as the array. Move the > >>> subroutine into the if-statement as well

Re: File::Find help

2007-08-17 Thread Mr. Shawn H. Corey
Paul Lalli wrote: On Aug 16, 7:21 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: Paul Lalli wrote: So define the subroutine in the same scope as the array. Move the subroutine into the if-statement as well. Huh? What part of what I said did you not understand? All of it. Please spe

Re: File::Find help

2007-08-17 Thread Randal L. Schwartz
> ""Dan" == "Dan Sopher" <[EMAIL PROTECTED]> writes: "Dan> Thanks for everyone's replies. It helped a lot. It ended up like this. "Dan> My next question is the use of the array reference, @list. Is it bad "Dan> form? Your solution confuses me. Why not just: my @list; find sub { push @list,

Re: File::Find help

2007-08-17 Thread Paul Lalli
On Aug 16, 7:21 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Paul Lalli wrote: > > So define the subroutine in the same scope as the array. Move the > > subroutine into the if-statement as well. > > Huh? What part of what I said did you not understand? > Please speak Perl. Please learn s

Re: File::Find help

2007-08-17 Thread Paul Lalli
On Aug 16, 7:21 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Paul Lalli wrote: > > So define the subroutine in the same scope as the array. Move the > > subroutine into the if-statement as well. > > Huh? What part of what I said did you not understand? > Please speak Perl. Please learn s

Re: File::Find help

2007-08-16 Thread Chas Owens
On 8/16/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Paul Lalli wrote: > > So define the subroutine in the same scope as the array. Move the > > subroutine into the if-statement as well. > > Huh? > > Please speak Perl. > > Subroutines are global. Unless they're anonymous. And even then, t

RE: File::Find help

2007-08-16 Thread Dan Sopher
Thanks for everyone's replies. It helped a lot. It ended up like this. My next question is the use of the array reference, @list. Is it bad form? #!/usr/bin/perl -w use strict; use File::Find; if (1) { my $dir = "/var/SAMPLES"; my @list; find ( { wanted=>sub { &found(

Re: File::Find help

2007-08-16 Thread Mr. Shawn H. Corey
Paul Lalli wrote: So define the subroutine in the same scope as the array. Move the subroutine into the if-statement as well. Huh? Please speak Perl. Subroutines are global. Unless they're anonymous. And even then, they are. It's just difficult to get a hold on them. -- Just my 0.0

Re: File::Find help

2007-08-16 Thread Mr. Shawn H. Corey
Dan Sopher wrote: Hello. The following code example creates a list of regular files in a directory. Using File::Find, I'm unable to localize an array to hold the list of files. Is there a way to create the list with a localized array? TIA. #!/usr/bin/perl -w ## Create a list of regular files

  1   2   >