On Tue, Jan 20, 2015 at 9:47 AM, Mike Martin 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 wasnt matching, so
On Tue, 20 Jan 2015 17:47:58 +
Mike Martin 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 search
for /-u/
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 opti
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";
}
--
On Tue, 20 Jan 2015 10:23:42 -0500
Brandon McCaig wrote:
> On Tue, Jan 20, 2015 at 10:21 AM, Brandon McCaig
> 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
On Tue, Jan 20, 2015 at 10:21 AM, Brandon McCaig 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'
(then search for "q
On Tue, Jan 20, 2015 at 9:51 AM, Andrew Solomon 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 doing still, but
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 wrote:
> For me, regex can be simple or complex.
> It depen
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 s
On Mon, 19 Jan 2015 11:43:41 -0500
John Mason wrote:
> On Mon, Jan 19, 2015 at 11:36 AM, Shawn H Corey
> wrote:
>
> > On Mon, 19 Jan 2015 11:18:01 -0500
> > bill pemberton wrote:
> >
> > > I fail to see why a regex can only be changed by a programmer.
> > > please expand upon this.
> >
> > You
On Mon, Jan 19, 2015 at 11:36 AM, Shawn H Corey
wrote:
> On Mon, 19 Jan 2015 11:18:01 -0500
> bill pemberton 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, there should be
checking/limit
On Mon, 19 Jan 2015 11:18:01 -0500
bill pemberton 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 ink does.
On Mon, 19 Jan 2015 15:57:35 +
Andrew Solomon wrote:
> On Mon, Jan 19, 2015 at 2:50 PM, Mike Martin
> wrote:
> > The lookup hash is like this
> > %clean=(
> > HeatingEngineer => (?:Heating.*?Engineer)\b.*?
> > HGV
> > Driver=>(?=\A(?:(?!tech|mech).)*$)(?:HGV|LGV|Class.?1|Class.?2).?(?
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 wrote:
> The lookup hash is li
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.?) (?:En
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
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 r
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 approa
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/
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
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 %
> "BM" == Bob McConnell 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/ev
From: Uri Guttman
> "BM" == Bob McConnell writes:
> BM> From: Philip Potter
> >> On 6 April 2010 16:52, Bob McConnell 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
> >>> scen
> "BM" == Bob McConnell writes:
BM> From: Philip Potter
>> On 6 April 2010 16:52, Bob McConnell 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 tes
On 9 April 2010 18:04, Bob McConnell 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, so I do lose
From: Philip Potter
> On 6 April 2010 16:52, Bob McConnell 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 ti
On Tue, Apr 6, 2010 at 11:52 AM, Bob McConnell 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 (IMO, at leas
On 6 April 2010 16:52, Bob McConnell 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 am using en
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
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",
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 thi
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 c
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
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,
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
c
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 sy
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 forma
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
> assigne
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 fin
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 = [
{
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 whic
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',
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 remark
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 tr
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 prin
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 so
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 l
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 = $arra
> "(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
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
&
> "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
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
>
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
"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',
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 me
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 {
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;
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
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,
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?
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 Hjalmars
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/
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 i
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
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 (key)
* 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
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.*
perldo
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() {
> # do stuff
> }
>
> for
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
>
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() {
# do stuff
}
open FH, '<', \$scalar or die "Cannot open \$sca
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() {
# do stuff
}
foreach (@array) {
# do stuff
}
When I had to do this I sp
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 basica
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
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() {
> # do stuff
> }
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() {
# do stuff
}
foreach (@array) {
# do stuff
}
When I had to do this I split the scalar in an
arra
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 (
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/ ) {
pr
> 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 "
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 ( m
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 (
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>
-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 ) {
>
>
To: beginners@perl.org
Sent: Tuesday, 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 f
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 ( $li
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: $!";
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 PO
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 a
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
> A
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 thi
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
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 9/8/06, Charles K. Clarkson <[EMAIL PROTECTED]> wrote:
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.
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
We
Hi Michael,
Following is one way ...
Here is am assuming that you have dumped that data into a array named
'@your_array' which contains each line in array references(array of arrays).
$table = new HTML::T
ignore this one.. I've already figured out how.
thanks.
--- Michael Alipio <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have an input file with 7 columns each line. Words
> are separated with 1 or more spaces..
> Now, I want each of these lines placed into
> HTML::Table's rows.
>
> The HTML::Table ha
Hi,
I have an input file with 7 columns each line. Words
are separated with 1 or more spaces..
Now, I want each of these lines placed into
HTML::Table's rows.
The HTML::Table has something like this.
each row (with 7 cells) is encolsed with []. I want
each row, populated with each line in my inpu
On Fri, 2006-28-04 at 15:40 +0100, Graeme McLaren wrote:
> Hi all, I need to loop over an array of hashes and assign a new hashref if a
> condition is met:
>
> I have a scalar which contains an array of hashes:
>
> $locations = [
> {
> 'location_name' => 'Fionas House',
>
Hi all, I need to loop over an array of hashes and assign a new hashref if a
condition is met:
I have a scalar which contains an array of hashes:
$locations = [
{
'location_name' => 'Fionas House',
'location_id' => '0027'
},
{
Harold Castro wrote:
>
> #This line is too tricky for me, all I know is that it
> has a ternary hook operator which returns $_ if the
> expression my @fields = map length() is true,
> otherwise, substitute empty fields with 'NA'. I looked
> into perldoc -f map as well as length() and as far as
> I
1 - 100 of 225 matches
Mail list logo