Accessing the values of HoH

2006-12-28 Thread M. Lewis
In my most recent postings, I was dealing with first HoA and now HoH. In my previous example code, I ended up with an output that looked something like this: jelly -- strawberry apple grape pear jam -- strawberry apple grape milk -- plain strawberry chocolate I thought I'd prefer to have it

Re: HoA question

2006-12-28 Thread M. Lewis
John W. Krahn wrote: M. Lewis wrote: John W. Krahn wrote: my %HoH; while (my $line = ){ chomp $line; my ($prod, $flavor) = split ' ', $line, 2; $HoH{ $prod }{ $flavor } = (); } for my $i ( keys %HoH ) { print "$i -- @{[ keys %{$HoH{$i}} ]}\n"; } Does it matter that the value

Re: HoA question

2006-12-28 Thread John W. Krahn
M. Lewis wrote: > John W. Krahn wrote: >> >> my %HoH; >> >> while (my $line = ){ >> chomp $line; >> my ($prod, $flavor) = split ' ', $line, 2; >> $HoH{ $prod }{ $flavor } = (); >> } >> >> for my $i ( keys %HoH ) { >> print "$i -- @{[ keys %{$HoH{$i}} ]}\n"; >> } > > Does it matter

HTML to DOC Converter

2006-12-28 Thread Anish Kumar K.
Hi I have a series of HTML tags in one file and want to convert to a DOC file how is it possible. Do we have any specific modules For Ex: Read a HTML file write to a document Read the Second HTML file and write to the same document (Append) Thanks Anish -- To unsubscribe, e-mail: [EMAIL PROTEC

Re: HoA question

2006-12-28 Thread M. Lewis
John W. Krahn wrote: my %HoH; while (my $line = ){ chomp $line; my ($prod, $flavor) = split ' ', $line, 2; $HoH{ $prod }{ $flavor } = (); } for my $i ( keys %HoH ) { print "$i -- @{[ keys %{$HoH{$i}} ]}\n"; } Does it matter that the value of the HoH is undef? jelly -- straw

Re: HoA question

2006-12-28 Thread M. Lewis
John W. Krahn wrote: M. Lewis wrote: I'm still experimenting with the HoA from a couple of days ago. I just realized there is the possibility for having duplicate elements of the array. How do I prevent that? Use a hash instead of an array. Thank you John. I wondered about that as I was c

Re: HoA question

2006-12-28 Thread John W. Krahn
M. Lewis wrote: > > I'm still experimenting with the HoA from a couple of days ago. I just > realized there is the possibility for having duplicate elements of the > array. How do I prevent that? Use a hash instead of an array. > #!/usr/bin/perl > > use strict; > use warnings; > > use Data::Du

HoA question

2006-12-28 Thread M. Lewis
I'm still experimenting with the HoA from a couple of days ago. I just realized there is the possibility for having duplicate elements of the array. How do I prevent that? Thanks, Mike #!/usr/bin/perl use strict; use warnings; use Data::Dumper::Simple; my %HoA; while (my $line = ){ c

Re: better way to skip first few lines of file read?

2006-12-28 Thread Dr.Ruud
Alan Campbell schreef: > [attribution repaired] Ricardo: >> [attribution repaired] Ruud: [quote characters fixed] >>>while $. <= 4; >> >> $. is not well-known to many Perl programmers. I don't think you are right. And it was used in the original posting. >>for 1 .. 4; > > thanks. Abov

Re: XML in, XML out

2006-12-28 Thread Jenda Krynicky
From: "Beginner" <[EMAIL PROTECTED]> > Hi All (and a happy holiday to those that will get a break), > > I am trying to read in an XML file of addresses. I need to remove all > the address data from the file where code =~ /^000/ (there are none in > the example data below). I need to reproduce that

Re: HoA building

2006-12-28 Thread Chad Perrin
I sent a message to the list already mentioning that after checking perldoc -f split one more time I found where it mentioned using a quoted literal space as the matching pattern. For some reason, it seems that nobody saw the message, because I have seen several messages so far quoting the releva

Re: Fwd: click_button gives error on a existing button

2006-12-28 Thread Owen
On Thu, 28 Dec 2006 09:53:05 +0100 "Tatiana Lloret Iglesias" <[EMAIL PROTECTED]> wrote: > Thanks Owen, > but in this case, inspecting the html page i see that the button hasn't got > NAME attribute but only VALUE that's why i've used value command. > The strange thing is that to pass from page 1

Re: better way to skip first few lines of file read?

2006-12-28 Thread Alan Campbell
>while $. <= 4; $. is not well-known to many Perl programmers. for 1 .. 4; >>> thanks. Above solution is simple & effective. I agree that I was >>> gratuitously using $. when your solution is far easier to document and >>> probably safer in my program since I have several filehandles op

Re: Strange problem with glob <>

2006-12-28 Thread Madhur Kashyap
Okies... yeah ..later I changed it to glob() and it worked, but I was little bit concerned why it works with switch module. Nevertheless, I have had wierd troubles with Switch module in past ... Thanks Madhur On 12/28/06, Mumia W. <[EMAIL PROTECTED]> wrote: On 12/28/2006 01:42 AM, Madhur Kashy

Re: Strange problem with glob <>

2006-12-28 Thread Mumia W.
On 12/28/2006 01:42 AM, Madhur Kashyap wrote: Hi there, Have a look at these two different implementations. IMPL2 works somehow. The problem I am facing is that the glob <$pat> does not return any value in IMPL1 but it returns in IMPL2. Can somebody tell what could be the problem. [...] Use

Re: HoA building

2006-12-28 Thread Dr.Ruud
Chad Perrin schreef: > [split works differently with ' ', /\s/, /\s+/] > Why doesn't perldoc -f split say anything about that? Never mind, I > guess that's a rhetorical question. It is all in the documentation: [...] By default, empty leading fields are preserved, and empty trailing ones a

Re: HoA building

2006-12-28 Thread M. Lewis
Igor Sutton wrote: 2006/12/28, Chad Perrin <[EMAIL PROTECTED]>: On Thu, Dec 28, 2006 at 03:31:36AM -0500, M. Lewis wrote: > > Chad, I've been experimenting with this a bit since your posting. Maybe > this will help: (I'm trying to understand the diff too) > > perl -le' > my $ln = "one two thr

Re: HoA building

2006-12-28 Thread Chad Perrin
On Thu, Dec 28, 2006 at 02:01:54AM -0700, Chad Perrin wrote: > > Why doesn't perldoc -f split say anything about that? Never mind, I > guess that's a rhetorical question. Igor just pointed out to me that it is, in fact, in perldoc -f split, and I just managed to miss it when I looked through it

Re: HoA building

2006-12-28 Thread Chad Perrin
On Thu, Dec 28, 2006 at 08:51:26AM +, Igor Sutton wrote: > 2006/12/28, Chad Perrin <[EMAIL PROTECTED]>: > > > >That makes sense, considering I just checked the tutorials at PerlMonks > >and discovered that, according to split(), ' ' and /\s+/ are exactly the > >same. Frankly, I find that a bit

Fwd: click_button gives error on a existing button

2006-12-28 Thread Tatiana Lloret Iglesias
Thanks Owen, but in this case, inspecting the html page i see that the button hasn't got NAME attribute but only VALUE that's why i've used value command. The strange thing is that to pass from page 1 to page 2 it works but to pass from page 2 to page 3 it fails ... although the code is the same

Re: HoA building

2006-12-28 Thread Igor Sutton
2006/12/28, Chad Perrin <[EMAIL PROTECTED]>: On Thu, Dec 28, 2006 at 03:31:36AM -0500, M. Lewis wrote: > > Chad, I've been experimenting with this a bit since your posting. Maybe > this will help: (I'm trying to understand the diff too) > > perl -le' > my $ln = "one two three four "; > print

Re: HoA building

2006-12-28 Thread Igor Sutton
Hi Chad, 2006/12/28, Chad Perrin <[EMAIL PROTECTED]>: [snip] Actually, on second thought, I seem to recall that ' ' has a meaning in split() beyond a literal space. Unfortunately, I don't recall exactly what that is. I've tried looking it up using perldoc -f split and in several books I ha

Re: HoA building

2006-12-28 Thread Chad Perrin
On Thu, Dec 28, 2006 at 03:31:36AM -0500, M. Lewis wrote: > > Chad, I've been experimenting with this a bit since your posting. Maybe > this will help: (I'm trying to understand the diff too) > > perl -le' > my $ln = "one two three four "; > print map " |$_| ", split /\s/, $ln; > print map "

Re: Strange problem with glob <>

2006-12-28 Thread Igor Sutton
Hi Madhur, 2006/12/28, Madhur Kashyap <[EMAIL PROTECTED]>: Hi there, Have a look at these two different implementations. IMPL2 works somehow. The problem I am facing is that the glob <$pat> does not return any value in IMPL1 but it returns in IMPL2. Can somebody tell what could be the problem

Re: HoA building

2006-12-28 Thread M. Lewis
Chad Perrin wrote: John W. Krahn wrote: M. Lewis wrote: while (my $ln = ){ chomp $ln; my ($prod, $flavor) = split /\s/, $ln, 2; You probably should use ' ' instead of /\s/ as the first argument to split: my ($prod, $flavor) = split ' ', $ln, 2; Ok, but why? Are they not the same?

Re: click_button gives error on a existing button

2006-12-28 Thread Owen Cook
On Thu, Dec 28, 2006 at 08:46:25AM +0100, Tatiana Lloret Iglesias wrote: > Hi! > I'm executing this perl and I get an error in this line_ > $browser2->click_button( value => "Next 25 records"); > > but i dont understand why because Next 25 records button exists!! > Can you help me with this please