Luckily in these cases, the faster answer is also the clearest answer in
either case.
On Mon, Jan 29, 2018 at 5:32 PM Paul Johnson wrote:
> On Sun, Jan 28, 2018 at 10:57:25PM +, Chas. Owens wrote:
> > $#array is the index of the last element of @array, so it will be one
>
On Sun, Jan 28, 2018 at 10:57:25PM +, Chas. Owens wrote:
> $#array is the index of the last element of @array, so it will be one less
> than scalar @array which is the number of elements in @array (since Perl
> arrays start with index 0). Therefore, to get the number of elements, you
> would
$#array is the index of the last element of @array, so it will be one less
than scalar @array which is the number of elements in @array (since Perl
arrays start with index 0). Therefore, to get the number of elements, you
would need to add one to $#array, which makes scalar @array faster. To get
Hi,
since Perl 5.12 you can use Each to give back the index as well:
Code:
use v5.12;
my @ar = ('mais', 'kirschen', 'bohnen', 'gurken');
while(my ($index, $value) = each(@ar)) {
say Index: $index - Value: $value;
}
Outcome:
Index: 0 - Value: mais
Index: 1 - Value:
On Thu, Aug 08, 2013 at 12:30:10PM -0500, Andy Bach wrote:
On Thu, Aug 8, 2013 at 12:05 PM, Unknown User
knowsuperunkn...@gmail.comwrote:
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
On Thu, Aug 08, 2013 at 11:30:29PM -0500, Andy Bach wrote:
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
my $counter = 0;
foreach my $e ( a .. z ) {
$counter++;
if ( $counter == 5 ) {
}
}
I know this is a perl idiom but I, and I suspect others, would find a perl
variable useful for the keeping the count when iterating. The draw back
with the above is that $counter
You probably can use 'state' instead of 'my' to keep $counter in scope.
foreach my $e ( 'a'..'z' ) {
state $counter++;
if ( $counter == 5 ) {
say $e;
}
}
Cheers,
Jing
On 9 Aug 2013, at 16:24, Dermot paik...@gmail.com wrote:
my $counter = 0;
foreach my $e ( a .. z ) {
On 08/09/2013 04:24 AM, Dermot wrote:
my $counter = 0;
foreach my $e ( a .. z ) {
$counter++;
if ( $counter == 5 ) {
}
}
I know this is a perl idiom but I, and I suspect others, would find a perl
variable useful for the keeping the count when iterating. The
On 08/09/2013 04:34 AM, Jing Yu wrote:
You probably can use 'state' instead of 'my' to keep $counter in scope.
foreach my $e ( 'a'..'z' ) {
state $counter++;
if ( $counter == 5 ) {
say $e;
}
}
and what if that code is run again in the same program? it will keep the
That is true.. Perhaps it's better to introduce a bare block enclosing the
loop, and declare $count as 'my' just before 'foreach'.
Cheers,
Jing
On 9 Aug 2013, at 16:39, Uri Guttman u...@stemsystems.com wrote:
On 08/09/2013 04:34 AM, Jing Yu wrote:
You probably can use 'state' instead of
my $counter = 0;
foreach my $e ( a .. z ) {
$counter++;
On Thu, Aug 8, 2013 at 12:05 PM, Unknown User knowsuperunkn...@gmail.comwrote:
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?
my $counter = 0;
foreach my $e ( a .. z ) {
$counter++;
if ( $counter == 5 ) {
}
}
On Thu, Aug 8, 2013 at 12:11 PM, jbiskofski jbiskof...@gmail.com wrote:
my $counter = 0;
foreach my $e ( a .. z ) {
$counter++;
On Thu, Aug 8, 2013 at 12:05 PM,
On Thu, Aug 8, 2013 at 12:05 PM, Unknown User knowsuperunkn...@gmail.comwrote:
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
On Thu, Aug 8, 2013 at 2:05 PM, Unknown User knowsuperunkn...@gmail.comwrote:
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
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 knowsuperunkn...@gmail.com wrote:
Hello,
If i am iterating through the elements in an array, at any point is it
possible to say
Something like this:
while(DATA){
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 knowsuperunkn...@gmail.com wrote:
Hello,
If i am iterating through the elements in an
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?
But
On Wed, 2 Jan 2013 16:05:25 +0530
Neeraj neeraj.seh...@gmail.com wrote:
Why do i have white-space between words when printing array while not
getting white-space when printing individual element.
perlfaq explains this - from perlfaq5:
Why do I get weird spaces when I print an array of
Neeraj,
If you print an array inside double quotes, each item of the array is separated
by the value specified in Perl special variable $ which is the Output list
separator. (interpolated lists)
By default the value of $ is space
So you can rewrite your code modifying the Output list
Neeraj wrote:
Hi,
I am new to Perl and perplexed with output of printing entire Array vs
printing each element
+4 ## check Array vis-a-vis List
+5
+6 @arr = qwhello happy new year 2013;
+7 print my array is : @arr \n;
+8
+9 ## lets print in a loop
+10 my
*Shaji Kalidasan* wrote:
Neeraj,
If you print an array inside double quotes, each item of the array is
separated by the value specified in Perl special variable $ which is
the Output list separator. (interpolated lists)
It is just the _List Separator_ , it has nothing to do with output.
.
---
From: John W. Krahn jwkr...@shaw.ca
To: Perl Beginners beginners@perl.org
Sent: Wednesday, 2 January 2013 6:11 PM
Subject: Re: Array vs List output
*Shaji Kalidasan* wrote:
Neeraj
Would this help.
@match = (6c7b00, 6d7b00, 6d9d8f, 6c6863, 6e6632);
%abc = ('6c' ='device1', '6d'= 'device5', '6e'= 'device3',
'6g'='device9');
foreach my $element(@match) {
print $element.=.$abc{substr($element, 0, 2)}.\n;
}
--
Shekar
On Thu, Oct 4, 2012 at 10:14 PM, Lawrence
Hi Shekar,
Appreciate your help, you saved me a lot of time !
I applied your loop and it works fine. Apologies i couldn't post my final
program due to our internal system restriction.hence i have used test data
here.
@match = (6c7b00, 6d7b00, 6d9d8f, 6c6863, 6e6632);
%abc = ('6c' ='device1',
Yes. Loop through the array, for each element get the first 2 characters
using substr, then pass it to hash as key to get the corresponding value.
--
Shekar
On Fri, Oct 5, 2012 at 4:51 PM, jet speed speedj...@googlemail.com wrote:
Hi Shekar,
Appreciate your help, you saved me a lot of
Great. Thanks Shekar !
On Fri, Oct 5, 2012 at 12:37 PM, Shekar c.shekar1...@gmail.com wrote:
Yes. Loop through the array, for each element get the first 2 characters
using substr, then pass it to hash as key to get the corresponding value.
--
Shekar
On Fri, Oct 5, 2012 at 4:51 PM,
On Thu, 4 Oct 2012 17:26:23 +0100
jet speed speedj...@googlemail.com wrote:
I am trying to find the array elements in hash, if it matches then
print the hash value. Please help me to achieve this.
Note: array elements matches the first 2 characters of the hash keys.
@match = (6c7b00,
On 10/04/2012 11:26 AM, jet speed wrote:
Hi All,
I am trying to find the array elements in hash, if it matches then print
the hash value. Please help me to achieve this.
Note: array elements matches the first 2 characters of the hash keys.
@match = (6c7b00, 6d7b00, 6d9d8f, 6c6863, 6e6632);
On Mon, 27 Aug 2012 18:57:08 -0500
Chris Stinemetz chrisstinem...@gmail.com wrote:
I am trying to incorporate sprintf to access an element in an array.
Not needed. Do this instead:
$cp_cell = $data[$cp_cell_index];
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as
Hi Chris,
On Sun, 19 Aug 2012 08:49:25 -0500
Chris Stinemetz perlqu...@gmail.com wrote:
Hello List,
I have input data such as far below:
I would like to read the data into an array and modify the 2nd index
if the 0th and first indices are identical.
I would like the updated 2nd index to
Chris Stinemetz wrote in message news
Hello List,
I have input data such as far below:
I would like to read the data into an array and modify the 2nd index if the
0th and first indices are identical.
I would like the updated 2nd index to be an average of the 2nd index where
both occurences of
Chris Charley wrote in message
Chris Stinemetz wrote in message news
Hello List,
I have input data such as far below:
I would like to read the data into an array and modify the 2nd index if
the
0th and first indices are identical.
I would like the updated 2nd index to be an average of
Hi Shomi,
Appreciate your comments.Thanks
I find it difficult to understand, if i convert into has. i.e keys and
corresponding values. if my keys are from @actzone and values are from
@all. How can i do this, becuase there are 2 keys and values are multiple
ex. alias: wwn: etc.
how can i
Hi jet speed,
I apologise for sending my reply to you in private instead of to the list. It
was an
accident.
On Fri, 17 Aug 2012 15:10:03 +0100
jet speed speedj...@googlemail.com wrote:
Hi Shomi,
It's Shlomi.
Appreciate your comments.Thanks
You're welcome.
I find it difficult to
Isn't this basically the format of YAML? Couldn't a YAML CPAN module handle
this data?
On 2012-08-17, at 10:10 AM, jet speed speedj...@googlemail.com wrote:
Hi Shomi,
Appreciate your comments.Thanks
I find it difficult to understand, if i convert into has. i.e keys and
corresponding
On Fri, 17 Aug 2012 15:10:03 +0100
jet speed speedj...@googlemail.com wrote:
Your code is lacking indentation.
Perhaps you should consider using Perl::Tidy to automatically format
your code.
http://search.cpan.org/~shancock/Perl-Tidy-20120714/lib/Perl/Tidy.pm
--
Just my 0.0002 million
Chaps,
Thanks for all your comments, I am strill trying to resolve my inital
query. Any help would be much appreciated.
I have the below program. i can match the entries in actzone.txt file in
bluealias.txt and print it.
what i would like to achive is to print the alias name and the reated wwn
On Aug 17, 2012, at 10:07 AM, jet speed wrote:
Chaps,
Thanks for all your comments, I am strill trying to resolve my inital
query. Any help would be much appreciated.
I have the below program. i can match the entries in actzone.txt file in
bluealias.txt and print it.
what i would
Hi Chris,
On Fri, Jul 13, 2012 at 3:28 AM, Shawn H Corey shawnhco...@gmail.comwrote:
On 12-07-12 10:25 PM, Chris Stinemetz wrote:
I have an anonymous array below and would like to know how to pass the
first element to a subroutine as a parameter.
push @data,
On 12-07-12 10:25 PM, Chris Stinemetz wrote:
I have an anonymous array below and would like to know how to pass the
first element to a subroutine as a parameter.
push @data, [$srt,$srfc,$cfc,$cfcq,$cell,$icell,$isector,$sector];
call to subroutine:
session_attempts($srt);
Thank you in
Hi Yuma,
a few comments on your code.
On Mon, 2 Jul 2012 23:10:36 +1000
Yuma More yuma...@gmail.com wrote:
Hi there:
I am very new in Perl and I am trying to write a script to search for
similar text in two different files, If it founds a match, it should out
put the whole line from the
Hi there:
I am very new in Perl and I am trying to write a script to search for
similar text in two different files, If it founds a match, it should out
put the whole line from the second file in a third file.
Let say that my first file (F1) has a list of some samples like
Than you Chris, your scrip is very helpful and know about BioPerl Module
also. I appreciated it .
On Mon, Jul 2, 2012 at 11:55 PM, Chris Charley char...@pulsenet.com wrote:
Hi there:
I am very new in Perl and I am trying to write a script to search for
similar text in two different files,
On 17/05/2012 23:19, Shawn H Corey wrote:
On 12-05-17 05:24 PM, Chris Stinemetz wrote:
push(@fields, $Icell,$Isect,$Ichan,$cfc,$cfcq,$rtd);
# push an anonymous array for each record
push @fields, [ $Icell,$Isect,$Ichan,$cfc,$cfcq,$rtd ];
}
}
my @sorted_fields = sort {
$a-[0]= $b-[0]
On 12-05-17 03:36 PM, Chris Stinemetz wrote:
I would like to sort the array by
$fields[0],$fields[1],$fields[2],$fields[3],$fields[4],$fields[5] in
ascending order starting witht he first element before I print the
array.
Do you want the fields sorted or do you want records sorted? If you want
On 05/17/2012 04:52 PM, Shawn H Corey wrote:
On 12-05-17 03:36 PM, Chris Stinemetz wrote:
I would like to sort the array by
$fields[0],$fields[1],$fields[2],$fields[3],$fields[4],$fields[5] in
ascending order starting witht he first element before I print the
array.
Do you want the fields
Thank you Uri and Shawn.
I am getting the following error and not sure how to resolve:
I will also checkout the great suggestions Uri made.
Can't use string (3) as an ARRAY ref while strict refs in use at
./DBSRtest.pl line 51, line 999.
#!/usr/bin/perl
use warnings;
use strict;
use POSIX;
On 12-05-17 05:24 PM, Chris Stinemetz wrote:
Thank you Uri and Shawn.
I am getting the following error and not sure how to resolve:
I will also checkout the great suggestions Uri made.
Can't use string (3) as an ARRAY ref while strict refs in use at
./DBSRtest.pl line 51, line 999.
Thanks for your help, I will look carefully at both of your comments.
cheers
From: John W. Krahn jwkr...@shaw.ca
To: Perl Beginners beginners@perl.org
Sent: Friday, 13 April 2012 6:08 AM
Subject: Re: Array of Hashes
Rob Dixon wrote:
Hi Paul and welcome
Hi All
I have solved the problem, I would be interested in any comments however on
this script. Positive and negative comments are welcome.
#!/usr/bin/perl
use strict;
use warnings;
my @vggroup;
my @PV;
my $PV=0;
my $Extents;
my $AllocatedPE;
my $rec = {};
my $href;
my $extent;
On 12/04/2012 12:48, Paul.G wrote:
Hi All
New to this group, so hello to everybody.
I am currently working on creating a Array of Hashes, note it is a
work in progress. I appear to be getting some corruption when
inputting data with the pvdisplay, I can't see why this is the case.
I have put
Rob Dixon wrote:
Hi Paul and welcome to the list.
I can see a few things wrong with your code, but I have only a Windows
machine so cannot test any changes I am suggestion so please beware.
The reason you get the marked line in your output is because that is
what you have written. This loop
Thank you Jim. Your advice worked perfectly.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On Sun, Jan 8, 2012 at 11:15 PM, Chris Stinemetz
chrisstinem...@gmail.comwrote:
How do I extract uniq elements from an array? Basically I want to
preserve the order of the elements as they are first seen, but I would
like to remove any duplicates.
You may want to check out List::MoreUtils on
At 11:15 PM -0600 1/8/12, Chris Stinemetz wrote:
How do I extract uniq elements from an array? Basically I want to
preserve the order of the elements as they are first seen, but I would
like to remove any duplicates.
Use a hash to keep track of elements. Create an entry in the hash
with the
On Jan 23, 2:55 am, jwkr...@shaw.ca (John W. Krahn) wrote:
Peter K. Michie wrote:
I have this regex expression in a script that appears to do an array
like split of a string but I cannot figure out how it does so. Any
help appreciated
$fname = ($0 =~ m[(.*/)?([^/]+)$])[1] ;
print 7
Peter K. Michie wrote:
I have this regex expression in a script that appears to do an array
like split of a string but I cannot figure out how it does so. Any
help appreciated
$fname = ($0 =~ m[(.*/)?([^/]+)$])[1] ;
print 7 $errlog\n;
$fpath = ($0 =~ m[(.*/)?([^/]+)$])[0] ;
print 8 $errlog\n;
于 2010-12-15 1:38, Jim Gibson 写道:
or the File::Find module to find files without resorting
to the use of separate processes and shell commands.
Me second.
File::Find is your friend.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail:
or the File::Find module to find files without resorting
to the use of separate processes and shell commands.
Me second.
File::Find is your friend.
Also, since you seem to be familiar with find use find2perl and you barely
have to lift a finger. Its like training wheels for File::Find -
On 12/14/10 Tue Dec 14, 2010 9:18 AM, Matt lm7...@gmail.com scribbled:
I am assigning a number of elements to an array like so:
my @new = `find /home/*/new -cmin 1 -type f`;
That works fine. I would also like to append more lines to that array
from here:
find /home/*/filed -cmin 1
Matt wrote:
I am assigning a number of elements to an array like so:
my @new = `find /home/*/new -cmin 1 -type f`;
That works fine. I would also like to append more lines to that array
from here:
find /home/*/filed -cmin 1 -type f
How do I do that without losing whats in the array already?
too much freaking data. i increased my scroll buffer and found that i do get
data, just not the last 1k lines err
On Mon, Nov 15, 2010 at 12:33 PM, shawn wilson ag4ve...@gmail.com wrote:
so, i'm thinking i'm not understanding references here again, but here's
what i have.
i fill in
sw == shawn wilson ag4ve...@gmail.com writes:
swmy $worksheetout = $workbookout-add_worksheet( '$year' );
why are you quoting $year? that doesn't do what you think it does. in
fact it is a bug. you aren't checking if you get results out of that
call which is another problem.
uri
--
Uri
On Mon, Nov 15, 2010 at 1:54 PM, Uri Guttman u...@stemsystems.com wrote:
sw == shawn wilson ag4ve...@gmail.com writes:
swmy $worksheetout = $workbookout-add_worksheet( '$year' );
why are you quoting $year? that doesn't do what you think it does. in
fact it is a bug. you aren't
On Jul 26, 3:22 am, sharan.basa...@gmail.com (Sharan Basappa) wrote:
Hi,
Can someone tell me how to convert an array to hash.
Each array entry has a row of values
e.g. a(0) = ab cd ef; a(1) = mn de fg
The hash array needs to be constructed with one of the element in the
array row as the
Dear Sharan,
Can someone tell me how to convert an array to hash.
Each array entry has a row of values
e.g. a(0) = ab cd ef; a(1) = mn de fg
The hash array needs to be constructed with one of the element in the
array row as the key.
e.g. hash{ab} = cd ef - ab is a string in the array
Hi Paul,
a few comments on your code - so you'll know how to write Perl better.
On Wednesday 05 May 2010 02:52:03 Paul Fontenot wrote:
Hi,
I'm stuck on using an array to determine the out come of a foreach loop.
The script is below.
foreach $line (LOGFILE) {
while (my $line = $logfile) would be a better idea than foreach $line.
Just curious for an explanation to this. I tend to use foreach too. Don't they
both accomplish the same thing? :)
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For
Brian wrote:
foreach $line (LOGFILE) {
while (my $line = $logfile) would be a better idea than foreach $line.
Just curious for an explanation to this. I tend to use foreach too. Don't they
both accomplish the same thing? :)
Yes, but they go about it in different ways. The
On Wednesday 05 May 2010, Shlomi Fish wrote:
2. Don't use bareword filehandles - use lexical ones:
open(my $output, , $output) or die Could not append to output - $!;
Wouldn't there be any issues if we use same name for lexical filehandle and the
scalar variable. Is Perl too intelligent to
On Wednesday 05 May 2010 17:20:25 Akhthar Parvez K wrote:
On Wednesday 05 May 2010, Shlomi Fish wrote:
2. Don't use bareword filehandles - use lexical ones:
open(my $output, , $output) or die Could not append to output - $!;
Wouldn't there be any issues if we use same name for lexical
On Wednesday 05 May 2010, Shlomi Fish wrote:
Wouldn't there be any issues if we use same name for lexical filehandle and
the scalar variable. Is Perl too intelligent to recognize both of them?
There certainly would be, and I don't think Perl is that intelligent to
multiplex between the
On Wednesday 05 May 2010, Shawn H Corey wrote:
Brian wrote:
foreach $line (LOGFILE) {
while (my $line = $logfile) would be a better idea than foreach $line.
Just curious for an explanation to this. I tend to use foreach too. Don't
they both accomplish the same thing? :)
On Wed, May 5, 2010 at 10:18 AM, Shlomi Fish shlo...@iglu.org.il wrote:
Hi Paul,
a few comments on your code - so you'll know how to write Perl better.
On Wednesday 05 May 2010 02:52:03 Paul Fontenot wrote:
Hi,
I'm stuck on using an array to determine the out come of a foreach loop.
Akhthar Parvez K wrote:
On Wednesday 05 May 2010, Shawn H Corey wrote:
Brian wrote:
foreach $line (LOGFILE) {
while (my $line = $logfile) would be a better idea than foreach $line.
Just curious for an explanation to this. I tend to use foreach too.
Don't they both accomplish the
On Wednesday 05 May 2010, Rob Coops wrote:
Would it not be more efficient to reset the file handle to the star of the
file?
use strict;
use warnings;
use Fcntl qw(:seek);
...
foreach my $condition (@conditions) {
seek ( $fh, 0, 0 ) or die ERROR: Could not reset file handle\n;
while
On Wed, May 5, 2010 at 7:21 PM, Akhthar Parvez K
akht...@sysadminguide.comwrote:
On Wednesday 05 May 2010, Rob Coops wrote:
Would it not be more efficient to reset the file handle to the star of
the
file?
use strict;
use warnings;
use Fcntl qw(:seek);
...
foreach my $condition
On Wednesday 05 May 2010, Rob Coops wrote:
A file never starts life being huge but certainly logs tend to grow, and
they are not always kept in check properly so assume they will be massive
(I've seen flat text logs that grew by as much as +1GB per day) assuming
that the file will always be
On Wed, May 5, 2010 at 8:50 PM, Akhthar Parvez K
akht...@sysadminguide.comwrote:
On Wednesday 05 May 2010, Rob Coops wrote:
A file never starts life being huge but certainly logs tend to grow, and
they are not always kept in check properly so assume they will be massive
(I've seen flat
On Wednesday 05 May 2010, John W. Krahn wrote:
If I could explain this further for Perl beginners:
With that foreach statement, it reads the file first and creates an
array with each line as elements and that array is being looped so the
overhead is higher, whereas with that while
APK == Akhthar Parvez K akht...@sysadminguide.com writes:
APK Thanks for the explanation John. Could you give one or two real
APK time examples where you used a list (instead of an array) except
APK in loops such as: for ('a', 'b', 'c', 'd')? I wonder if I'm
APK underusing lists in my
On Thursday 06 May 2010, Rob Coops wrote:
Of course and a system like nagios does exactly that, it reports errors and
positives, mail is of course not the way right to deal with monitoring
certainly in large environments it is simply not done via mail. Currently
looking at the monitoring
On 5/4/10 Tue May 4, 2010 4:52 PM, Paul Fontenot wpfonte...@cox.net
scribbled:
Hi,
I'm stuck on using an array to determine the out come of a foreach loop.
The script is below.
--
--
Jim Gibson wrote:
You need to reset LOGFILE to the beginning for subsequent iterations over
the @conditions array. As written, the nested foreach will never be executed
except for the first condition. Add the indicated seek call.
The actual command is seek. See `perldoc -f seek` or
Thank you very much
On 5/4/2010 6:12 PM, Shawn H Corey wrote:
Jim Gibson wrote:
You need to reset LOGFILE to the beginning for subsequent iterations
over
the @conditions array. As written, the nested foreach will never be
executed
except for the first condition. Add the indicated seek call.
JG == Jim Gibson jimsgib...@gmail.com writes:
JG On 5/4/10 Tue May 4, 2010 4:52 PM, Paul Fontenot wpfonte...@cox.net
JG scribbled:
JG You need to reset LOGFILE to the beginning for subsequent
JG iterations over the @conditions array. As written, the nested
JG foreach will never be
Hi Raphael!
Welcome to Perl.
On Thursday 25 Feb 2010 12:41:30 raphael() wrote:
use strict;
use warnings;
It's good that you're using strict and warnings;
use Data::Dumper;
my @links =
({
name1 = 'http://www.abc.com/data/a/000/name1.txt',
name2 =
Hi Raphael!
On Thursday 25 Feb 2010 12:59:33 raphael() wrote:
My BAD :(
THERE IS NO FIRST ELEMENT IN A HASH!!
PLEASE FORGIVE ME. I AM IN A THICK OF EVERYTHING TODAY.
LET ME REPHRASE --
HOW DO I LOOP OVER THE ANONYMOUS HASH WHICH IS INSIDE AN ARRAY?
OK, no need to use all-caps (it's
raphael() wrote:
use strict;
use warnings;
use Data::Dumper;
my @links =
({
name1 = 'http://www.abc.com/data/a/000/name1.txt',
name2 = 'http://www.abc.com/data/a/000/name2.txt',
});
for my $element ( @links ) {
for my $name ( sort keys %$element ) {
print $name --
raphael() wrote:
My BAD :(
THERE IS NO FIRST ELEMENT IN A HASH!!
PLEASE FORGIVE ME. I AM IN A THICK OF EVERYTHING TODAY.
LET ME REPHRASE --
HOW DO I LOOP OVER THE ANONYMOUS HASH WHICH IS INSIDE AN ARRAY?
use strict;
use warnings;
my @links =
({
name1 =
Hi raphael!
I believe you meant to CC this to the list, so I'm CCing it (I don't see
anything in your reply that needs to be in private).
On Thursday 25 Feb 2010 13:42:07 raphael() wrote:
On Thu, Feb 25, 2010 at 4:50 PM, Shlomi Fish shlo...@iglu.org.il wrote:
Hi Raphael!
On Thursday 25
Shlomi Fish wrote:
... WxWidgets has wxGlade ...
Does it? Thanks Shlomi I am very fond of Wx and didn't know about this.
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On Thursday 25 Feb 2010 17:09:02 Rob Dixon wrote:
Shlomi Fish wrote:
... WxWidgets has wxGlade ...
Does it? Thanks Shlomi I am very fond of Wx and didn't know about this.
You're welcome. I think I've tried it and wasn't really impressed and returned
to a standard writing-GUI-code-in-Perl
On Wed, May 13, 2009 at 01:59, John W. Krahn jwkr...@shaw.ca wrote:
snip
What's your point?
I am trying to understand what point you are trying to make.
snip
I believe the point is that declaration is only one of the things my
does, so saying that my() happens when the code is compiled so it
Chas. Owens wrote:
On Wed, May 13, 2009 at 01:59, John W. Krahn jwkr...@shaw.ca wrote:
snip
What's your point?
I am trying to understand what point you are trying to make.
snip
I believe the point is that declaration is only one of the things my
does, so saying that my() happens when the
On Tue, May 12, 2009 at 14:30, AndrewMcHorney andrewmchor...@cox.net wrote:
Hello
I put the strict and warning statements in my perl code. I now need to
initialize arrays. What is the best way to initialize an array before the
loop where I will basically recreating the array size in the loop?
AndrewMcHorney wrote:
Hello
Hello,
I put the strict and warning statements in my perl code. I now need to
initialize arrays. What is the best way to initialize an array before
the loop where I will basically recreating the array size in the loop?
my @array = ?
while (more work to do)
{
[stuff cut out]
It is usually best to declare variables in the smallest scope possible so:
while (more work to do)
{
my @array = split $string;
# do work on array
}
Doesn't that try to re-localize (?) the @array variable every time through
the loop? i.e. doesn't it re-run the my()
Bryan Harris wrote:
[stuff cut out]
It is usually best to declare variables in the smallest scope possible
so:
while (more work to do)
{
my @array = split $string;
# do work on array
}
Doesn't that try to re-localize (?) the @array variable every time
through the loop? i.e.
1 - 100 of 688 matches
Mail list logo