develooper Front page | perl.beginners | Postings from January 2002

split and extraction

Thread Next
From:
Dhiraj P Nilange
Date:
January 30, 2002 07:21
Subject:
split and extraction
Message ID:
20020130151913.14035.qmail@mailFA12.rediffmail.com

Hi there

I want to extract some word after space from some string.
Somebody from the mailing list had given me above
command.

suppose I wanto extract 8th word...

#suppose $abc  has the string;
$abc=split[/\s+/]->[8];   #somebody told me like this.

but it doesnt work. if i use some array in the split function like:-

@array=split(/\s+/,$abc);
print $array[8];

this way it works. But I dont want to use array. Its newbie question actually.

pls help.

Thanks
-Dhiraj
 


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About