
rajiv_chennai
Novice
Jun 4, 2008, 10:07 PM
Post #2 of 3
(1802 views)
|
|
Re: [jujea] how can I extract from file with info separated by newline
[In reply to]
|
Can't Post
|
|
Lets try this code,i think this what you are expecting.
#!/usr/bin/perl my @array=<DATA>; my @first_array=grep(/First Name :(.)/,@array); map{~s/First Name :(.)/$1/}@first_array; my @last_array=grep(/Last Name :(.)/,@array); map{~s/Last Name :(.)/$1/}@last_array; print @first_array; print "\n"; print @last_array; __END__ First Name : James Last Name : Segrove DOB : 07/26/1970 Email : jsegrove@ntlworld.com Password : tramontana Address : 50 Chesilton Crescent City : Fleet Zip : GU52 6PB State : Hanmshire Country : United Kingdom Phone : 01252 616106 --------------------------------------------------------------------------------------------------------- Regards Rajiv
(This post was edited by perlguru_admin on Jun 8, 2008, 9:57 AM)
|