Mechanize or LWP::RobotUA - which one does it

2008-06-08 Thread jobst müller
hello first of all: i am new to the list., i work in the field-research. To begin with: well i have the data in a bunch of plain text files on the local disk. Well i need to collect some of the data out of a site - here is an example. http://www.bamaclubgp.org/forum/sitemap.php the problem

Re: Looping through an anonymous array of arrays

2008-06-08 Thread Randal L. Schwartz
> "(Randal" == (Randal L Schwartz) <[EMAIL PROTECTED]> writes: (Randal> my @items = @$arrayRef; (Randal> while (@items) { (Randal> if (ref $items[0]) { (Randal> if (ref $items[0] eq "ARRAY") { (Randal> unshift @items, @{shift @items}; # replace arrayref with co

Re: HoH problem representing a data structure.

2008-06-08 Thread Rob Dixon
Rodrick Brown wrote: > On Sun, Jun 8, 2008 at 10:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> > wrote: > >> Rodrick Brown wrote: >> >>> #!/usr/bin/perl -w >>> >> The -w switch is redundant, since you have "use warnings;". >> >> use strict; >>> use warnings; >>> use Data::Dumper; >>> my $file = '

Re: HoH problem representing a data structure.

2008-06-08 Thread Gunnar Hjalmarsson
Rodrick Brown wrote: On Sun, Jun 8, 2008 at 10:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: push @{ $hash->{$homeDir} }, $user; Yes please explain how exactly that line works? I know @{} dereferences an array so it looks like your pushing each user into an anonymous array. Yes, t

Re: looping 2 times through 5000 differs from 5000 times through 2

2008-06-08 Thread Rob Dixon
oldgeezer wrote: > Hi all, > > Last week I discovered this perl.beginners group. > Good stuff here, albeit many times hard to grasp > the answers. But I'm learning. > > What I would like to understand is why looping > 2 times through 5000 lines takes less time than > looping 5000 times through 2

Re: HoH problem representing a data structure.

2008-06-08 Thread Rodrick Brown
On Sun, Jun 8, 2008 at 10:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Rodrick Brown wrote: > >> >> #!/usr/bin/perl -w >> > > The -w switch is redundant, since you have "use warnings;". > > use strict; >> use warnings; >> use Data::Dumper; >> my $file = '/etc/passwd'; >> my $hash; >> my

Re: Create a list of files in a directory (recursively)

2008-06-08 Thread Rob Dixon
moroshko wrote: > > What is the most efficient way to get a list of all file names (a full > path) in a certain directory ? > This should work recursively and include only files (not directories). The canonical method is to use File::Find as John has described. Rob -- To unsubscribe, e-mail: [

Re: File Locked after Close?

2008-06-08 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > > I'm doing the following: > > open FILE, ' # Do something with FILE > close FILE; > system 'command file.dat'; # This fails > > The last line fails even though I closed FILE. However, if I break > out the last line into a separate script that is run later, it runs >

Re: HoH problem representing a data structure.

2008-06-08 Thread Gunnar Hjalmarsson
Rodrick Brown wrote: #!/usr/bin/perl -w The -w switch is redundant, since you have "use warnings;". use strict; use warnings; use Data::Dumper; my $file = '/etc/passwd'; my $hash; my ($user, $homeDir); my $count=0; Why did you declare that variable? open(my $fh, "<", $file) or die("Fatal

Re: Looping through an anonymous array of arrays

2008-06-08 Thread Randal L. Schwartz
> "Aruna" == Aruna Goke <[EMAIL PROTECTED]> writes: Aruna> for my $item (@$arrayRef){ Aruna> print $item unless ref($item) eq 'ARRAY'; Aruna> if(ref($item) eq 'ARRAY'){ Aruna>for my $item1(@$item){ Aruna>print $item1 unless ref($item1) eq 'ARRAY'; Aruna> { Arun

Re: HoH problem representing a data structure.

2008-06-08 Thread Rodrick Brown
I want each Hash element to point to an array or list of users that share the same home dir instead of another hash. ie. $VAR1 = { '/var/imap' => { '_cyrus' }, '/var/empty' => { '_spotlight'

Re: looping 2 times through 5000 differs from 5000 times through 2

2008-06-08 Thread Jenda Krynicky
From: oldgeezer <[EMAIL PROTECTED]> > What I would like to understand is why looping > 2 times through 5000 lines takes less time than > looping 5000 times through 2 lines. > > To show what I mean, I wrote a snippet that > does nothing with the data and yet the first > part is 5 times faster than

Re: Create a list of files in a directory (recursively)

2008-06-08 Thread John W. Krahn
moroshko wrote: Hello experts ! Hello, What is the most efficient way to get a list of all file names (a full path) in a certain directory ? This should work recursively and include only files (not directories). use File::Find; my @all_file_names; find sub { return if -d; push @al

Re: looping 2 times through 5000 differs from 5000 times through 2

2008-06-08 Thread John W. Krahn
oldgeezer wrote: Hi all, Hello, Last week I discovered this perl.beginners group. Good stuff here, albeit many times hard to grasp the answers. But I'm learning. If you have any questions just ask (the list.) What I would like to understand is why looping 2 times through 5000 lines takes

Re: Looping through an anonymous array of arrays

2008-06-08 Thread Dr.Ruud
"Rodrick Brown" schreef: > my $arrayRef = [ 1, 2, 3, ['a', 'b', 'c', ["Hello"] ]]; > > I have no problem returning single elements but how would one walk > this list of elements with say a for loop? Start writing it differently, maybe like: my $data = [ 1, 2, 3, [ 'a',

Re: Create a list of files in a directory (recursively)

2008-06-08 Thread Dr.Ruud
moroshko schreef: > What is the most efficient way to get a list of all file names (a full > path) in a certain directory ? > This should work recursively and include only files (not directories). Consider IO::All. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PR

looping 2 times through 5000 differs from 5000 times through 2

2008-06-08 Thread oldgeezer
Hi all, Last week I discovered this perl.beginners group. Good stuff here, albeit many times hard to grasp the answers. But I'm learning. What I would like to understand is why looping 2 times through 5000 lines takes less time than looping 5000 times through 2 lines. To show what I mean, I wrot

Re: Create a list of files in a directory (recursively)

2008-06-08 Thread Jeff Peng
On Sat, Jun 7, 2008 at 11:30 PM, moroshko <[EMAIL PROTECTED]> wrote: > Hello experts ! > > What is the most efficient way to get a list of all file names (a full > path) in a certain directory ? > This should work recursively and include only files (not directories). Hi, Just show a way. The code

File Locked after Close?

2008-06-08 Thread xmp333
Hi, I'm doing the following: open FILE, 'http://learn.perl.org/

Re: Can not get reliable output [WAS: Reg. Directory listing program]

2008-06-08 Thread Michelle Konzack
Hello John, Am 2008-06-06 11:06:09, schrieb John W. Krahn: > $ perl -le'printf "%o\n", 33279' > 100777 > > > 33279 is the decimal representation of a number, and 0777 is the octal > representation of a number. If a number has a leading zero it is > usually displayed in octal representation. >

Create a list of files in a directory (recursively)

2008-06-08 Thread moroshko
Hello experts ! What is the most efficient way to get a list of all file names (a full path) in a certain directory ? This should work recursively and include only files (not directories). Thanks in advance ! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: HoH problem representing a data structure.

2008-06-08 Thread Aruna Goke
Rodrick Brown wrote: I'm trying to fully understand references so I created a data structure to stores the output of users on my system who share home dirs. I use a HoH to represent this data set but its not working as expected. Conceptually I can visualize how the data should look but I cant get

Re: HoH problem representing a data structure.

2008-06-08 Thread Aruna Goke
Rodrick Brown wrote: I'm trying to fully understand references so I created a data structure to stores the output of users on my system who share home dirs. I use a HoH to represent this data set but its not working as expected. Conceptually I can visualize how the data should look but I cant get

Re: HoH problem representing a data structure.

2008-06-08 Thread John W. Krahn
Rodrick Brown wrote: I'm trying to fully understand references so I created a data structure to stores the output of users on my system who share home dirs. I use a HoH to represent this data set but its not working as expected. Conceptually I can visualize how the data should look Perhaps if y

HoH problem representing a data structure.

2008-06-08 Thread Rodrick Brown
I'm trying to fully understand references so I created a data structure to stores the output of users on my system who share home dirs. I use a HoH to represent this data set but its not working as expected. Conceptually I can visualize how the data should look but I cant get the output any assista