Hi, thanks all! I have solve my problem. But I have another question
now,
How to determin whether I reach the end of file in Perl program? Also
, can you tell me where I can get these informations . I scan the
programing perl by Larry Wall, But it is diffculty to find what I
want
Frank [F], on Monday, May 16, 2005 at 21:34 (+0800) wrote the
following:
F How to determin whether I reach the end of file in Perl program? Also
F , can you tell me where I can get these informations . I scan the
F programing perl by Larry Wall, But it is diffculty to find what I
F want
Thanks! Mr. Clarkson's program really works. but because my array
(data) is more complex. So I made an adjustment but it did not work very
well.
BTW: John W. Krahn suggested I can change Input Record Separator, it
does work and help me to solve the problem! But I just wonder why the
Frank mailto:[EMAIL PROTECTED] wrote:
: The results given like this, it seems the loop works only for one time
:
: common_white
: paper
: milk_white
: milk
This is what you asked perl to do. Let's walk the script.
First time through $item is blue. Since $after_white tests false,
Frank [F], on Sunday, May 15, 2005 at 19:45 (+0800) typed:
F If i know the element of array, can I get the numeric index of this
F element?
Exist a way, but it is better using hash. In arrays you have to
iterate over every element.
--
...m8s, cu l8r, Brano.
[Thank goodness for my twit
Ing. Branislav Gerzo wrote:
Frank [F], on Sunday, May 15, 2005 at 19:45 (+0800) typed:
F If i know the element of array, can I get the numeric index of this
F element?
Exist a way, but it is better using hash. In arrays you have to
iterate over every element.
~~~Pls tell me the way.
Hi,
Let's say you have the following array:
my @array = (
'blue',
'white',
'red',
'blue',
'green',
'blue',
);
And let's say you want to get the index for the 'blue' element.
I guess it is obvious that you need to analyse element by element, in order
to be able to find if that array contains
Thanks Octavian, I do need analyze element by element. but the
problem for me is like this
my @array = (
blue
sky
skirt
sea
white
paper
flower
red
face
flower
green
grand
tree
)
Say, I need get all elements after white before red. Be notice,
any new color begin with , so, I think I can
my
On Sun, 15 May 2005, Frank wrote:
If i know the element of array, can I get the numeric index of this
element?
In general, you'd have to write code to walk through the array, then
make a note of the index when you get the value you want. Something like
this might do what you're asking for
hello ,
you can do something like the following
my $counter = -1;
foreach (@array){
$counter++;
if($_ =~m/$word/){
print Element ID is $counter;}
}
On 5/15/05, Frank [EMAIL PROTECTED] wrote:
Ing. Branislav Gerzo wrote:
Frank [F], on Sunday, May 15, 2005 at 19:45 (+0800) typed:
F
Frank mailto:[EMAIL PROTECTED] wrote:
: Thanks Octavian, I do need analyze element by element. but the
: problem for me is like this
:
: my @array = (
: blue
: sky
: skirt
: sea
: white
: paper
: flower
: red
: face
: flower
: green
: grand
: tree
: )
:
: Say, I need get all elements after
11 matches
Mail list logo