Sent: 4/7/2006 8:54:47 AM
To: activeperl@listserv.ActiveState.com
Subject: RE: foreach question
> Conrad, Bill (ThomasTech) <> wrote:
> > I thought that Perl had another internal variable that contained
> the
> > numerical index of each array entry without having to count them.
is almost always a better choice."
>-Original Message-
>From: [EMAIL PROTECTED] [mailto:activeperl-
>[EMAIL PROTECTED] On Behalf Of Thurn, Martin
>Sent: Friday, April 07, 2006 8:42 AM
>To: DZ-Jay; Conrad, Bill (ThomasTech)
>Cc: activeperl@listserv.ActiveState.com
>Subje
Conrad, Bill (ThomasTech) <> wrote:
> I thought that Perl had another internal variable that contained
the
> numerical index of each array entry without having to count them. I
> guess what I thought was happening internally was that Perl was
> maintaining an index of @List and returning @Lis
> In fact, "foreach" is just a short hand for those times when
> you only need the contents of the list or to perform an
> operation "for each item", but have no need for the index or
> the list itself.
Not sure what you're implying here, but the fact is: there is NO
DIFFERENCE between 'for
>
>
> my @List = qw(one two three);
>
> for(0 .. $#List) {
> print "Indice $_ contains: $List[$_]\n";
> }
Thanks Dave
After seeing your reply it jogged my memory and this is exactly how
I did it before. I had forgotten about the $#list
Thanks to all who replied to my question.
On Apr 6, 2006, at 15:25, Conrad, Bill (ThomasTech) wrote:
I thought that Perl had another internal variable that contained the
numerical index of each array entry without having to count them. I
guess
what I thought was happening internally was that Perl was maintaining
an
index of @L
In a message dated 4/6/2006 6:17:47 P.M. Eastern Standard Time,
[EMAIL PROTECTED] writes:
> > From: "Conrad, Bill (ThomasTech)"> > Subject: foreach
question> > > > Give a foreach loop> > >
> foreach $entry ( @list ) {> > > > }>
Conrad, Bill (ThomasTech) wrote:
Hi All
Give a foreach loop
foreach $entry ( @list ) {
}
Is there a way to get the position index within @list $entry is from
without counting the iterations of the loop
my @List = qw(one two three);
for(0 .. $#List) {
pr
- Original Message -
From: "Conrad, Bill (ThomasTech)" <[EMAIL PROTECTED]>
To:
Sent: Thursday, April 06, 2006 6:38 PM
Subject: foreach question
Hi All
Give a foreach loop
foreach $entry ( @list ) {
}
Is there a way to get the position index within @list $entry
> From: "Conrad, Bill (ThomasTech)"
> Subject: foreach question
>
> Give a foreach loop
>
> foreach $entry ( @list ) {
>
> }
>
> Is there a way to get the position index within @list $entry is from
> without counting the iterations of the loop
Wha
No.
On 4/6/06, Conrad, Bill (ThomasTech)
<[EMAIL PROTECTED]> wrote:
> Hi All
>
> Give a foreach loop
>
> foreach $entry ( @list ) {
>
> }
>
> Is there a way to get the position index within @list $entry is from
> without counting the iterations of the loop
>
> Than
Hi Kyle
Thanks for your reply.
If I have the following
my @List ( 'one' , 'two' , 'three' ) ;
foreach ( @List ) {
print $_ . "\n" ;
}
it will print
one
two
three
I thought that Perl had ano
- Original Message -
From: Conrad, Bill (ThomasTech)
Sent: 4/6/2006 12:38:20 PM
To: activeperl@listserv.ActiveState.com
Subject: foreach question
> Hi All
>
> Give a foreach loop
>
> foreach $entry ( @list ) {
>
> }
>
> Is ther
Hi All
Give a foreach loop
foreach $entry ( @list ) {
}
Is there a way to get the position index within @list $entry is from
without counting the iterations of the loop
Thanks
Bill Conrad
___
ActivePerl mailing list
14 matches
Mail list logo