Re: Looping regexes against a list

2015-01-20 Thread Andrew Solomon
Hey Mike Aside from this lengthy rant^H^H^H^H discussion:) about where you put your regex, have you made any progress on the performance problem you put forward at the outset? cheers Andrew On Tue, Jan 20, 2015 at 6:41 AM, Danny Spell ddsp...@gmail.com wrote: For me, regex can be simple or

Re: Looping regexes against a list

2015-01-20 Thread Shawn H Corey
What the OP should do is put the regexes in a Perl module and unroll the loop. That way, he can group them so that groups of tests are skipped: # strings containing foo if( /foo/ ){ return food if /food/; return fool if /fool/; return foot if /foot/; return foo; } -- Don't

Re: Looping regexes against a list

2015-01-20 Thread Brandon McCaig
On Tue, Jan 20, 2015 at 10:21 AM, Brandon McCaig bamcc...@gmail.com wrote: perldoc -f qr// I was sure that worked in my up-to-date perlbrew environments, but it isn't working in Cygwin running perl 5.14.2 so in the event that it doesn't work for you look at `perldoc -f qr' and `perldoc perlop'

Re: Looping regexes against a list

2015-01-20 Thread Shawn H Corey
On Tue, 20 Jan 2015 10:23:42 -0500 Brandon McCaig bamcc...@gmail.com wrote: On Tue, Jan 20, 2015 at 10:21 AM, Brandon McCaig bamcc...@gmail.com wrote: perldoc -f qr// I was sure that worked in my up-to-date perlbrew environments, but it isn't working in Cygwin running perl 5.14.2 so in

Re: Looping regexes against a list

2015-01-20 Thread Charles DeRykus
On Tue, Jan 20, 2015 at 9:47 AM, Mike Martin m...@redtux.org.uk wrote: Thanks for the idea about qr, I did try this before, but I've now relooked at at it and got about 75% improvement. As regards the uninitialized point the errors were coming from regexes (different ones) when the regex

Re: Looping regexes against a list

2015-01-20 Thread Brandon McCaig
On Tue, Jan 20, 2015 at 9:51 AM, Andrew Solomon and...@geekuni.com wrote: Aside from this lengthy rant^H^H^H^H discussion:) about where you put your regex, have you made any progress on the performance problem you put forward at the outset? I'm not quite sure that I understand what the OP is

Re: Looping regexes against a list

2015-01-20 Thread Mike Martin
Thanks for the idea about qr, I did try this before, but I've now relooked at at it and got about 75% improvement. As regards the uninitialized point the errors were coming from regexes (different ones) when the regex wasnt matching, so testing the result of each regex match was not really an

Re: Looping regexes against a list

2015-01-20 Thread Shawn H Corey
On Tue, 20 Jan 2015 17:47:58 + Mike Martin m...@redtux.org.uk wrote: Take a load of Job Vacancy posts (xml files - loads of) Parse the Information, getting rid of as much garbage as possible Push a distinct list into a lookup hash If you're running Linux (or any POSIX), see `man sort` and

Re: Looping regexes against a list

2015-01-19 Thread Danny Spell
For me, regex can be simple or complex. It depends on the task at hand. The more complex the task, the more complex the regex. My boss who can code, but doesn't want to, *HATES* regex. Personally, I think it is pretty powerful and I'm grateful for its flexibility. I use it daily in my job where

Looping regexes against a list

2015-01-19 Thread Mike Martin
Hi I am looking for the most performant way to achieve this I have a big list of text (47+ lines in a hash) I then run a hash ref consisting of replacement text - pattern to search - optional 3rd param for grouping matches So I loop through the text and then loop the regex hash against each

Re: Looping regexes against a list

2015-01-19 Thread Brandon McCaig
Mike: On Mon, Jan 19, 2015 at 01:25:56PM +, Mike Martin wrote: Hi Hello, I am looking for the most performant way to achieve this I have a big list of text (47+ lines in a hash) I then run a hash ref consisting of replacement text - pattern to search - optional 3rd param for

Re: Looping regexes against a list

2015-01-19 Thread Mike Martin
The lookup hash is like this %clean=( HeatingEngineer = (?:Heating.*?Engineer)\b.*? HGV Driver=(?=\A(?:(?!tech|mech).)*$)(?:HGV|LGV|Class.?1|Class.?2).?(?:1|2|3|)(?:.+Driver|).*? HGV Mechanic= (?:(?:HGV|LGV|Lorry).+(?:Mech?anics?|technicians?))\b.*? Highway Engineer= (?:(?:Highway.?)

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 15:57:35 + Andrew Solomon and...@geekuni.com wrote: On Mon, Jan 19, 2015 at 2:50 PM, Mike Martin m...@redtux.org.uk wrote: The lookup hash is like this %clean=( HeatingEngineer = (?:Heating.*?Engineer)\b.*? HGV

Re: Looping regexes against a list

2015-01-19 Thread Andrew Solomon
First question which comes to mind is - do you really need to call sort in those two foreach collections? Sort can often take time, and the fact that you've got one sort nested inside a foreach loop is bad karma:) Andrew On Mon, Jan 19, 2015 at 2:50 PM, Mike Martin m...@redtux.org.uk wrote: The

Re: Looping regexes against a list

2015-01-19 Thread John Mason
On Mon, Jan 19, 2015 at 11:36 AM, Shawn H Corey shawnhco...@gmail.com wrote: On Mon, 19 Jan 2015 11:18:01 -0500 bill pemberton wape...@gmail.com wrote: I fail to see why a regex can only be changed by a programmer. please expand upon this. You shouldn't blindly trust input from a user,

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 11:18:01 -0500 bill pemberton wape...@gmail.com wrote: I fail to see why a regex can only be changed by a programmer. please expand upon this. Regex is a programming language in its own right. Why should an average user have any knowledge of it? -- Don't stop where the

Re: Looping regexes against a list

2015-01-19 Thread Shawn H Corey
On Mon, 19 Jan 2015 11:43:41 -0500 John Mason john.mason...@gmail.com wrote: On Mon, Jan 19, 2015 at 11:36 AM, Shawn H Corey shawnhco...@gmail.com wrote: On Mon, 19 Jan 2015 11:18:01 -0500 bill pemberton wape...@gmail.com wrote: I fail to see why a regex can only be changed by a

Re: looping through an array with for

2012-02-15 Thread Chris Stinemetz
Thank you Jim. Your suggestions worked perfectly! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: looping through an array with for

2012-02-15 Thread Igor Dovgiy
Hi Jim, Well, instead of asking at each step, whether the last element is processed or not, it's slightly better to exclude it from the loop: for my $i (0..$#keyFields - 1) { printf %s %s, $keyFields[$i], $match; } printf %s %s, $keyFields[-1], $lastmatch; But yes, I guess your last approach

looping through an array with for

2012-02-14 Thread Chris Stinemetz
I have a for loop I would like to alter so that when the iteration reaches the last element in the array the varibale $lastmatch is passed to printf instead of $match. Does anyone have any suggestions? my $match = GE 0 AND ; my $lastmatch = GE 0; for my $i (0 .. $#keyFields) { printf %s %s,

Re: looping through an array with for

2012-02-14 Thread Jim Gibson
At 9:08 PM -0700 2/14/12, Chris Stinemetz wrote: I have a for loop I would like to alter so that when the iteration reaches the last element in the array the varibale $lastmatch is passed to printf instead of $match. Does anyone have any suggestions? my $match = GE 0 AND ; my $lastmatch = GE

RE: Looping in Test::Harness

2010-04-09 Thread Bob McConnell
From: Philip Potter On 6 April 2010 16:52, Bob McConnell r...@cbord.com wrote: I have a test harness set up with a series of Selenium test scripts. Each script tests a specific scenario on my web site. But I have some scenarios that I want to test multiple times with different data entered

Re: Looping in Test::Harness

2010-04-09 Thread Philip Potter
On 9 April 2010 18:04, Bob McConnell r...@cbord.com wrote: After a great deal of reading and speculation, it looks like YAML is the way to go. I will have to move the loop inside each test script, and iterate thorough the records read. The biggest problem is that the plan is no longer fixed,

Re: Looping in Test::Harness

2010-04-09 Thread Uri Guttman
BM == Bob McConnell r...@cbord.com writes: BM From: Philip Potter On 6 April 2010 16:52, Bob McConnell r...@cbord.com wrote: I have a test harness set up with a series of Selenium test scripts. Each script tests a specific scenario on my web site. But I have some scenarios that I

RE: Looping in Test::Harness

2010-04-09 Thread Bob McConnell
From: Uri Guttman BM == Bob McConnell r...@cbord.com writes: BM From: Philip Potter On 6 April 2010 16:52, Bob McConnell r...@cbord.com wrote: I have a test harness set up with a series of Selenium test scripts. Each script tests a specific scenario on my web site. But I have some

Re: Looping in Test::Harness

2010-04-09 Thread Uri Guttman
BM == Bob McConnell r...@cbord.com writes: BM From: Uri Guttman you can even use perl itself. just write a perl data structure and call do on it. it can be an anon array or hash which is the returned value. no need to learn yaml or load another module. you can also slurp/eval

Looping in Test::Harness

2010-04-06 Thread Bob McConnell
I have a test harness set up with a series of Selenium test scripts. Each script tests a specific scenario on my web site. But I have some scenarios that I want to test multiple times with different data entered each time. Currently I am using environment parameters to pass the test data into each

Re: Looping in Test::Harness

2010-04-06 Thread Philip Potter
On 6 April 2010 16:52, Bob McConnell r...@cbord.com wrote: I have a test harness set up with a series of Selenium test scripts. Each script tests a specific scenario on my web site. But I have some scenarios that I want to test multiple times with different data entered each time. Currently I

Re: Looping in Test::Harness

2010-04-06 Thread Brandon McCaig
On Tue, Apr 6, 2010 at 11:52 AM, Bob McConnell r...@cbord.com wrote: Is there a cleaner way to pass those variables into each test script? I'm unfamiliar with testing practices in Perl, but I would imagine that almost anything would be better than using environment variables to store test values

looping through multiple arrays

2008-09-04 Thread Bobby
Hi, I have a large pipe delimited text file that i want to loop through and sort out a column of data within that file. Let's call this column $sizes. I want to group these different sizes into categories. i.e. @sizeA = (A,B,C); @sizeB = (D,E,F); @sizeC = (G,H,I); This is what i want to do:

Re: looping through multiple arrays

2008-09-04 Thread Raja Vadlamudi
On Thu, Sep 4, 2008 at 12:36 PM, Raja Vadlamudi [EMAIL PROTECTED] wrote: On Thu, Sep 4, 2008 at 11:22 AM, Bobby [EMAIL PROTECTED] wrote: Hi, I have a large pipe delimited text file that i want to loop through and sort out a column of data within that file. Let's call this column $sizes. I

Re: looping through multiple arrays

2008-09-04 Thread John W. Krahn
Raja Vadlamudi wrote: On Thu, Sep 4, 2008 at 12:36 PM, Raja Vadlamudi [EMAIL PROTECTED] wrote: On Thu, Sep 4, 2008 at 11:22 AM, Bobby [EMAIL PROTECTED] wrote: I have a large pipe delimited text file that i want to loop through and sort out a column of data within that file. Let's call this

Re: looping through multiple arrays

2008-09-04 Thread Jenda Krynicky
From: Bobby [EMAIL PROTECTED] Hi, I have a large pipe delimited text file that i want to loop through and sort out a column of data within that file. Let's call this column $sizes. I want to group these different sizes into categories. i.e. @sizeA = (A,B,C); @sizeB = (D,E,F); @sizeC =

looping

2008-06-30 Thread dakin999
Hi, I am writting a perl script which: 1. Calls oracle database and produce the desired results While I am reading each row data that is fetched by select query from oracle databae, I need to read some other values from a text file. This is where I am having issues. Can some one help me in

Re: looping

2008-06-30 Thread Jeff Peng
On Mon, Jun 30, 2008 at 3:24 PM, dakin999 [EMAIL PROTECTED] wrote: While I am reading each row data that is fetched by select query from oracle databae, I need to read some other values from a text file. This is where I am having issues. Can some one help me in formalising the write syntax

Re: looping

2008-06-30 Thread Jeff Peng
On Tue, Jul 1, 2008 at 11:04 AM, Akhil Srivastava [EMAIL PROTECTED] wrote: Still I am not able to make it work. The problem is to read a file loop from inside a top loop and exit the file loop when the top loop finishes. You maybe should post the code piece to the list, we may have the

Re: looping

2008-06-30 Thread Gunnar Hjalmarsson
Jeff Peng wrote: On Tue, Jul 1, 2008 at 11:04 AM, Akhil Srivastava [EMAIL PROTECTED] wrote: Still I am not able to make it work. The problem is to read a file loop from inside a top loop and exit the file loop when the top loop finishes. You maybe should post the code piece to the list,

Re: looping over arrayref of hashes

2008-06-20 Thread Rob Dixon
Graeme McLaren wrote: Hi all, I'm in need of a loop, can't seem to find what I'm looking for online. I want to loop over this array ref inserting each hash value into the DB at each iteration.I've got the following data structure which is assigned to $aref: my $VAR1 = [ {

Re: looping over arrayref of hashes

2008-06-19 Thread Narthring
On Jun 18, 11:27 am, [EMAIL PROTECTED] (Graeme McLaren) wrote: Hi all, I'm in need of a loop, can't seem to find what I'm looking for online.  I want to loop over this array ref inserting each hash value into the DB at each iteration.I've got the following data structure which is assigned

looping over arrayref of hashes

2008-06-18 Thread Graeme McLaren
Hi all, I'm in need of a loop, can't seem to find what I'm looking for online. I want to loop over this array ref inserting each hash value into the DB at each iteration.I've got the following data structure which is assigned to $aref: $VAR1 = [ {'rate' = '1.98',

Re: looping over arrayref of hashes

2008-06-18 Thread Rodrick Brown
On Wed, Jun 18, 2008 at 12:27 PM, Graeme McLaren [EMAIL PROTECTED] wrote: Hi all, I'm in need of a loop, can't seem to find what I'm looking for online. I want to loop over this array ref inserting each hash value into the DB at each iteration.I've got the following data structure which is

Re: looping over arrayref of hashes

2008-06-18 Thread Gunnar Hjalmarsson
Graeme McLaren wrote: Hi all, I'm in need of a loop, can't seem to find what I'm looking for online. I want to loop over this array ref inserting each hash value into the DB at each iteration.I've got the following data structure which is assigned to $aref: $VAR1 = [ {

Re: looping over arrayref of hashes

2008-06-18 Thread Amit Saxena
Hi On the basis of what you have mentioned, I have made a sample code. Let me know if my understanding is different from yours. The Perl Code is copied below :- # cat u.pl #!/usr/bin/perl ##!/u01/app/oracle/product/10.1.0/db_1/perl/bin/perl # # Hi all, I'm in need of a loop, can't seem to

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

2008-06-12 Thread Jenda Krynicky
From: Rob Dixon [EMAIL PROTECTED] oldgeezer wrote: foreach my $entry (uniq @IK){ foreach my $line(@DATA) { # Note /;$entry;/ takes longer than # /$entry;/ and that takes longer than /$entry/ # But /$entry/ also splits remarks_entries. # So I need the trailing ';'

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

2008-06-12 Thread oldgeezer
Jenda Krynicky wrote: From: Rob Dixon [EMAIL PROTECTED] oldgeezer wrote: foreach my $entry (uniq @IK){ foreach my $line(@DATA) { # Note /;$entry;/ takes longer than # /$entry;/ and that takes longer than /$entry/ # But /$entry/ also splits remarks_entries. #

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

2008-06-11 Thread oldgeezer
On Jun 8, 5:03 pm, [EMAIL PROTECTED] (Rob Dixon) wrote: 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

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

2008-06-11 Thread Jenda Krynicky
From: oldgeezer [EMAIL PROTECTED] But you also made me aware of a mistake I always made until now. The three periods in for (x...y) I must have inherited that error from another language. Probably from an interpreter I wrote myself some 30 years ago. It's not an error. Just something

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

2008-06-11 Thread Rob Dixon
oldgeezer wrote: Hi all, Sorry for the late response, I've been busy doing something else. That's cool. As a newbie in this perl.beginners, I did not know that it is a good thing to tell what purpose the script has. My script is purely hobby. All my scripts are. As a general principle,

Re: Looping through an anonymous array of arrays

2008-06-10 Thread Rob Dixon
Rodrick Brown wrote: 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? use strict; use warnings; my $arrayRef = [ 1, 2, 3, ['a', 'b', 'c', [Hello] ]]; my @flat = $arrayRef;

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

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: 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

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: 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'){ Arunafor my $item1(@$item){ Arunaprint $item1 unless ref($item1) eq 'ARRAY'; Aruna { Aruna

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 lines

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 contents (Randal

Re: Looping through an anonymous array of arrays

2008-06-07 Thread Aruna Goke
Gunnar Hjalmarsson wrote: Rodrick Brown wrote: 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? One way: my $level = 0; breakdown( $arrayRef ); sub breakdown {

Looping through an anonymous array of arrays

2008-06-06 Thread Rodrick Brown
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?

Re: Looping through an anonymous array of arrays

2008-06-06 Thread Jeff Peng
On Sat, Jun 7, 2008 at 9:31 AM, Rodrick Brown [EMAIL PROTECTED] wrote: 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? Try this code: use strict; my $arrayRef = [ 1, 2, 3,

Re: Looping through an anonymous array of arrays

2008-06-06 Thread Chas. Owens
On Fri, Jun 6, 2008 at 9:31 PM, Rodrick Brown [EMAIL PROTECTED] wrote: 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? You can treat an array reference like an array by

Re: Looping through an anonymous array of arrays

2008-06-06 Thread Gunnar Hjalmarsson
Rodrick Brown wrote: 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? One way: my $level = 0; breakdown( $arrayRef ); sub breakdown { my $ref = shift;

looping thru delete check boxes

2008-02-26 Thread ken uhl
I have a page that displays a list of entries with Delete Check boxes how Do I loop thru all the checked entries, re-display in a 'confirmation' page and then do the deletes? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: looping thru delete check boxes

2008-02-26 Thread Gunnar Hjalmarsson
ken uhl wrote: I have a page that displays a list of entries with Delete Check boxes how Do I loop thru all the checked entries, re-display in a 'confirmation' page and then do the deletes? Learn some about CGI. http://www.cgi.resourceindex.com/Documentation/CGI_Tutorials/ -- Gunnar

Re: Looping Dates.

2008-01-25 Thread Anagram
Sara - You should look at perldoc.perl.org for the date-time related functions. You don't really need any special modules, though they can sometimes be helpful. Here is a key idea: dates in perl (and many other computer languages systems) are stored as an integer number that represents the

Return number of keys in a hash of hash? Looping through sub hash?

2008-01-24 Thread pzimmermann
I'd like to get the number of keys in hash of hashes. I know that I can do something like $count = keys( %myHash ), but how would I go about finding the number of keys in a sub-hash? Alternately, how could I loop through keys in a hash of a hash? My hash look like: -Part Number 1 --Type 1

Re: Return number of keys in a hash of hash? Looping through sub hash?

2008-01-24 Thread Tom Phoenix
On Jan 24, 2008 9:07 AM, [EMAIL PROTECTED] wrote: I'd like to get the number of keys in hash of hashes. I know that I can do something like $count = keys( %myHash ), but how would I go about finding the number of keys in a sub-hash? my $count = keys %{ $sub_hash_reference }; You can

Re: Return number of keys in a hash of hash? Looping through sub hash?

2008-01-24 Thread pzimmermann
On Jan 24, 10:12 am, [EMAIL PROTECTED] (Tom Phoenix) wrote: On Jan 24, 2008 9:07 AM, [EMAIL PROTECTED] wrote: I'd like to get the number of keys in hash of hashes. I know that I can do something like $count = keys( %myHash ), but how would I go about finding the number of keys in a

Looping Dates.

2008-01-20 Thread J Alejandro Ceballos Z
El 19/01/2008, a las 12:39 a.m., [EMAIL PROTECTED] escribió: beginners-cgi Digest 19 Jan 2008 06:39:46 - Issue 989 Topics (messages 13145 through 13145): Looping Dates. 13145 by: sara.samsara.gmail.com Administrivia: To subscribe to the digest, e-mail: [EMAIL

Re: Looping Dates.

2008-01-19 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I am stuck here, I want to get list of dates in a certain range. Like: Start Date: 2007-01-03 to End Date: 2007-05-30 I am pointless here as what should I do in order to get all dates between start and end? Is there any for, foreach loop or other method? that will

Looping Dates.

2008-01-18 Thread sara.samsara
I am stuck here, I want to get list of dates in a certain range. Like: Start Date: 2007-01-03 to End Date: 2007-05-30 I am pointless here as what should I do in order to get all dates between start and end? Is there any for, foreach loop or other method? that will generate a list of dates:

Re: Looping Dates.

2008-01-18 Thread Aruna Goke
[EMAIL PROTECTED] wrote: I am stuck here, I want to get list of dates in a certain range. Like: Start Date: 2007-01-03 to End Date: 2007-05-30 I am pointless here as what should I do in order to get all dates between start and end? Is there any for, foreach loop or other method? that will

RE: Looping Dates.

2008-01-18 Thread Duck McDonald
19, 2008 1:40 AM To: beginners-cgi@perl.org Subject: Looping Dates. Importance: High I am stuck here, I want to get list of dates in a certain range. Like: Start Date: 2007-01-03 to End Date: 2007-05-30 I am pointless here as what should I do in order to get all dates between start and end

Re: Looping Dates.

2008-01-18 Thread Owen
I am stuck here, I want to get list of dates in a certain range. Like: Start Date: 2007-01-03 to End Date: 2007-05-30 I am pointless here as what should I do in order to get all dates between start and end? Is there any for, foreach loop or other method? that will generate a list of dates:

Re: Looping through lines stored in a scalar

2008-01-03 Thread Jean-Rene David
* Paul Johnson [2008.01.01 22:10]: The most direct analogy would be to use an in-memory file: open my $fh, , \$scalar; print while $fh; Very nice. Thanks. I didn't understand what John and Chas were trying to say until I saw the term in-memory file. Exactly the kind of stuff I was hoping

Looping through lines stored in a scalar

2008-01-01 Thread Jean-Rene David
Hi, I wonder what idioms are available to loop through the lines stored in a scalar variable. I guess I'm looking for something analogous to these idioms for files and arrays respectively: while(FH) { # do stuff } foreach (@array) { # do stuff } When I had to do this I split the scalar in an

Re: Looping through lines stored in a scalar

2008-01-01 Thread Chas. Owens
On Dec 31, 2007 5:56 PM, Jean-Rene David [EMAIL PROTECTED] wrote: Hi, I wonder what idioms are available to loop through the lines stored in a scalar variable. I guess I'm looking for something analogous to these idioms for files and arrays respectively: while(FH) { # do stuff }

Re: Looping through lines stored in a scalar

2008-01-01 Thread Tom Phoenix
On Dec 31, 2007 2:56 PM, Jean-Rene David [EMAIL PROTECTED] wrote: When I had to do this I split the scalar in an array: @array = split \n, $scalar; foreach (@array) { # do stuff } What would be some other ways to do this? (This is purely curiosity.) This type of curiosity would be well

Re: Looping through lines stored in a scalar

2008-01-01 Thread yitzle
You can skip the array assignment and just do: foreach ( split \n, $scalar ) { ... } I predict a reply that uses map()... though I think that using a map isn't really another solution, but just an alternative to the for loop. map {stuff}, split \n, $scalar; But I think the answer is basically

Re: Looping through lines stored in a scalar

2008-01-01 Thread Rob Dixon
Jean-Rene David wrote: Hi, I wonder what idioms are available to loop through the lines stored in a scalar variable. I guess I'm looking for something analogous to these idioms for files and arrays respectively: while(FH) { # do stuff } foreach (@array) { # do stuff } When I had to do this I

Re: Looping through lines stored in a scalar

2008-01-01 Thread John W. Krahn
Jean-Rene David wrote: Hi, Hello, I wonder what idioms are available to loop through the lines stored in a scalar variable. I guess I'm looking for something analogous to these idioms for files and arrays respectively: while(FH) { # do stuff } open FH, '', \$scalar or die Cannot open

Re: Looping through lines stored in a scalar

2008-01-01 Thread Chas. Owens
On Jan 1, 2008 12:21 PM, yitzle [EMAIL PROTECTED] wrote: You can skip the array assignment and just do: foreach ( split \n, $scalar ) { ... } I predict a reply that uses map()... though I think that using a map isn't really another solution, but just an alternative to the for loop. map

Re: Looping through lines stored in a scalar

2008-01-01 Thread Paul Johnson
On Mon, Dec 31, 2007 at 05:56:35PM -0500, Jean-Rene David wrote: I wonder what idioms are available to loop through the lines stored in a scalar variable. I guess I'm looking for something analogous to these idioms for files and arrays respectively: while(FH) { # do stuff } foreach

Re: Looping through lines stored in a scalar

2008-01-01 Thread John W. Krahn
Chas. Owens wrote: If you have a recent enough version of Perl* you can say open my $fh, , \$scalar or die could not attach a file handle to \$scalar: $!; while (my $line = $fh) { chomp($line); #do stuff with $line } * 5.8 can do this, but I am not sure about 5.6.* perldoc -f

Re: looping through a file

2007-05-09 Thread Steve Bertrand
but if they appear in the file in a different sequence then you also need to rewind and start looking at the beginning of the file once again like this: ID: foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE ) { if ( $line =~ /$prime_id/ ) { print $line\n;

Re: looping through a file

2007-05-09 Thread Rob Dixon
Steve Bertrand wrote: but if they appear in the file in a different sequence then you also need to rewind and start looking at the beginning of the file once again like this: ID: foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE ) { if ( $line =~ /$prime_id/ ) {

Re: looping through a file

2007-05-09 Thread Chas Owens
On 5/9/07, Rob Dixon [EMAIL PROTECTED] wrote: Steve Bertrand wrote: but if they appear in the file in a different sequence then you also need to rewind and start looking at the beginning of the file once again like this: ID: foreach my $prime_id ( @id_hits ) { while ( my $line =

RE: looping through a file

2007-05-08 Thread Craig Schneider
Hi Guys Following is a log file extract which I desperately need to covert to coma separated for an entire logile called access.log (squid proxy log) for reporting purposes. There has been some internet surfing abuse on a client's network. 1178606984.937 1 192.168.1.55 TCP_DENIED/407 1904

Re: looping through a file

2007-05-08 Thread Dr.Ruud
Robert Hicks schreef: open my $IFILE, '', $IDFILE || die Could not open $IDFILE: $!; This doesn't mean what you assume it does. It is a mix up of: open(my $IFILE, '', $IDFILE) || die Could not open $IDFILE: $!; and open my $IFILE, '', $IDFILE or die Could not open $IDFILE: $!; --

Re: looping through a file

2007-05-08 Thread Robert Hicks
I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match and that is it. foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE ) { if (

Re: looping through a file

2007-05-08 Thread yaron
, May 8, 2007 4:39:12 PM (GMT+0200) Auto-Detected Subject: Re: looping through a file I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match

Re: looping through a file

2007-05-08 Thread Jeff Pang
-Original Message- From: [EMAIL PROTECTED] Sent: May 8, 2007 9:54 PM To: [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: looping through a file my @lines = $AFILE; foreach my $prime_id ( @id_hits ) { foreach my $line( @lines ) { if ( $line =~ /$prime_id

Re: looping through a file

2007-05-08 Thread Rob Dixon
Robert Hicks wrote: I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match and that is it. foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE

Re: looping through a file

2007-05-08 Thread Rob Dixon
Jeff Pang wrote: -Original Message- From: [EMAIL PROTECTED] Sent: May 8, 2007 9:54 PM To: [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: looping through a file my @lines = $AFILE; foreach my $prime_id ( @id_hits ) { foreach my $line( @lines ) { if ( $line

Re: looping through a file

2007-05-08 Thread Robert Hicks
Rob Dixon wrote: Robert Hicks wrote: I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match and that is it. foreach my $prime_id ( @id_hits ) { while (

looping through a file

2007-05-07 Thread Robert Hicks
I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this log. Once I find the line that the id is on, I need the next line

Re: looping through a file

2007-05-07 Thread Chas Owens
On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this log. Once I find

Re: looping through a file

2007-05-07 Thread Robert Hicks
Chas Owens wrote: On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this

Re: looping through a file

2007-05-07 Thread Chas Owens
On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: snip I think part of the problem is the 'shift'ing that I was doing. I am looking into that. Basically I was shift'ing the @log out of existence after the first pass. snip That sounds like a viable candidate for the warning as well. snip

Re: looping through a file

2007-05-07 Thread Robert Hicks
Chas Owens wrote: On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: snip I think part of the problem is the 'shift'ing that I was doing. I am looking into that. Basically I was shift'ing the @log out of existence after the first pass. snip That sounds like a viable candidate for the warning as

RE: looping through complicated hashes..

2006-09-08 Thread Charles K. Clarkson
Michael Alipio wrote: : ignore this one.. I've already figured out how. Why not post your solution for the archives? Someone else may run across your question during a search and will not know the answer you found. HTH, Charles K. Clarkson -- Mobile Homes Specialist Free Market Advocate

  1   2   3   >