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

File:: Find help

2013-01-10 Thread punit jain
Hi, 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 / usersettings /files/

File::Find help

2013-01-10 Thread punit jain
Hi, 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 / usersettings user2 / usersettings

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
ROTECTED] Sent: Thursday, August 16, 2007 3:46 PM To: beginners@perl.org Subject: File::Find help 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 li

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

Re: File::Find help

2007-08-16 Thread Paul Lalli
On Aug 16, 6:45 pm, [EMAIL PROTECTED] (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/

Re: File::Find help

2007-08-16 Thread Chas Owens
On 8/16/07, Dan Sopher <[EMAIL PROTECTED]> 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/

File::Find help

2007-08-16 Thread Dan Sopher
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 in a directory. us

Re: Format and File::Find --> Help Needed

2003-02-27 Thread R. Joseph Newton
Prasad Karpur wrote: > All, > > When I try to use $pathname to get the dir name in the format section, I don't see > any value. Also where do I add the follow_skip section in the File::Find program to > skip duplicate file names. > > #!/usr/bin/perl > > use File::Find; > > format OUTPUT_TOP = >

Format and File::Find --> Help Needed

2003-02-27 Thread Prasad Karpur
All, When I try to use $pathname to get the dir name in the format section, I don't see any value. Also where do I add the follow_skip section in the File::Find program to skip duplicate file names. #!/usr/bin/perl use File::Find; format OUTPUT_TOP = NAMEFILESIZE PATH --