Re: Array iterator count

2013-08-08 Thread Andy Bach
> And buggy, consider: my @timings = ( 11, 22, 3, 14, 18, 45, 18, ... 86 ); Yeah, it's a constraint without a cause. Do you want to treat every "18" in the "if " or only the first? Why not use a counter? Is the data from a list, a file or … ? Do we know it's the 5th element ahead of time? B

Re: Array iterator count

2013-08-08 Thread Jing Yu
Something like this: while(){ if(/d/){ print; say $.; } } __DATA__ a b c d e f g h i j k l m n o p q r s t u v w x y z Cheers, Jing On 9 Aug 2013, at 01:05, Unknown User wrote: > > Hello, > > > If i am iterating through the elements in an array, at any point is it >

Re: Array iterator count

2013-08-08 Thread Jing Yu
Or maybe you can convert your list into a file, and use the line number variable to do what you want. Cheers, Jing On 9 Aug 2013, at 01:05, Unknown User wrote: > > Hello, > > > If i am iterating through the elements in an array, at any point is it > possible to say which element i am handli

Re: parsing html

2013-08-08 Thread Rob Dixon
On 08/08/2013 18:18, David Precious wrote: On Thu, 8 Aug 2013 22:42:01 +0530 Unknown User wrote: What would be the best module available for parsing html in your opinion? My intention is to parse html that contains a table of 5 columns and any number of rows For parsing HTML tables, you want

Re: parsing html

2013-08-08 Thread Charles DeRykus
On Thu, Aug 8, 2013 at 10:18 AM, David Precious wrote: > On Thu, 8 Aug 2013 22:42:01 +0530 > Unknown User wrote: > > > What would be the best module available for parsing html in your > > opinion? My intention is to parse html that contains a table of 5 > > columns and any number of rows > > For

Re: parsing html

2013-08-08 Thread timothy adigun
On 8 Aug 2013 18:19, "Unknown User" wrote: > > > What would be the best module available for parsing html in your opinion? I would also say look at HTML::TreeBuilder > My intention is to parse html that contains a table of 5 columns and any number of rows, and have a hash ref like > $html->{1}->

Re: Array iterator count

2013-08-08 Thread Brian Fraser
On Thu, Aug 8, 2013 at 2:05 PM, Unknown User wrote: > > Hello, > > > If i am iterating through the elements in an array, at any point is it > possible to say which element i am handling without using a counter? Are > there any builtins that i can use for it? > > ie > foreach my $element (a..z) { >

Re: Array iterator count

2013-08-08 Thread Andy Bach
On Thu, Aug 8, 2013 at 12:05 PM, Unknown User wrote: > at any point is it possible to say which element i am handling without > using a counter? Er, well, if it were an array rather than a list my @letters = (a .. z); foreach my $letter ( a .. z ) { if ( $letter eq $letters[4] ) { but that's

Re: parsing html

2013-08-08 Thread Chankey Pathak
Have a look at HTML::PARSER. On Aug 8, 2013 10:50 PM, "Unknown User" wrote: > > What would be the best module available for parsing html in your opinion? > My intention is to parse html that contains a table of 5 columns and any > number of rows, and have a hash ref like > $html->{1}->{col1}=data

Re: parsing html

2013-08-08 Thread David Precious
On Thu, 8 Aug 2013 22:42:01 +0530 Unknown User wrote: > What would be the best module available for parsing html in your > opinion? My intention is to parse html that contains a table of 5 > columns and any number of rows For parsing HTML tables, you want HTML::TableExtract, IMO. https://metacp

parsing html

2013-08-08 Thread Unknown User
What would be the best module available for parsing html in your opinion? My intention is to parse html that contains a table of 5 columns and any number of rows, and have a hash ref like $html->{1}->{col1}=data11, $html->{1}->{col2}=data12 ... $html->{2}->{col1}=data21, $html->{2}->{col2}=data22 .

Re: Array iterator count

2013-08-08 Thread jbiskofski
my $counter = 0; foreach my $e ( a .. z ) { $counter++; if ( $counter == 5 ) { } } On Thu, Aug 8, 2013 at 12:11 PM, jbiskofski wrote: > my $counter = 0; > foreach my $e ( a .. z ) { > $counter++; > > > > On Thu, Aug 8, 2013 at 12:05 PM, Unknown User > wr

Re: Array iterator count

2013-08-08 Thread jbiskofski
my $counter = 0; foreach my $e ( a .. z ) { $counter++; On Thu, Aug 8, 2013 at 12:05 PM, Unknown User wrote: > > Hello, > > > If i am iterating through the elements in an array, at any point is it > possible to say which element i am handling without using a counter? Are > there any built

Array iterator count

2013-08-08 Thread Unknown User
Hello, If i am iterating through the elements in an array, at any point is it possible to say which element i am handling without using a counter? Are there any builtins that i can use for it? ie foreach my $element (a..z) { ... if ( i am the 5th element ) { handle me special } } Thanks,