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
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
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'
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
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
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
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
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
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
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
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
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.?)
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
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
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,
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
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
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/
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
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,
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
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
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,
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
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
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
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
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
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
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:
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
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
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 =
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
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
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
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,
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 = [
{
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
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',
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
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 = [
{
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
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 ';'
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.
#
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
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
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,
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;
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
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',
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
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
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
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
(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
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 {
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?
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,
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
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;
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/
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
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
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
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
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
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
[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
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:
[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
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
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:
* 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
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
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
}
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
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
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
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
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
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
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
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;
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/ ) {
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 =
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
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: $!;
--
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 (
, 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
-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
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
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
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 (
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
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
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
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
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
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 - 100 of 229 matches
Mail list logo