Hi there,
I am a Perl beginner. I am writing a Perl programm to parse some data. This is a little example to show you how the data looks like:
*****************
52 + 645 s 76
21 + 54 l 5 s 87
21 - Lib tmp 5446
*****************
My code looks like that:
##################
while(<FILE>)
{
@buf = split(/ /,$_);
if($buf[1] == "+"
{
# ....
}
else
{
# ....
}
}
close(FILE);
####################
The result of "if-statement" is always "false"!! Can you explain me how to realize this distinction of cases?
An other question: the first argument of split should be a character. Is there a possibility how to separate the buffer elements with a set of characater, for example both space and tab?
I would be very thankful for your help.
I am a Perl beginner. I am writing a Perl programm to parse some data. This is a little example to show you how the data looks like:
*****************
52 + 645 s 76
21 + 54 l 5 s 87
21 - Lib tmp 5446
*****************
My code looks like that:
##################
while(<FILE>)
{
@buf = split(/ /,$_);
if($buf[1] == "+"
{
# ....
}
else
{
# ....
}
}
close(FILE);
####################
The result of "if-statement" is always "false"!! Can you explain me how to realize this distinction of cases?
An other question: the first argument of split should be a character. Is there a possibility how to separate the buffer elements with a set of characater, for example both space and tab?
I would be very thankful for your help.