samy1212 has asked for the wisdom of the Perl Monks concerning the following question:
from my perl script I will be giving the profile name for example SECONDGRADE , then I will have to open that file and read to get the firstname lastname and middlename for the person in the SECONDGRADE which in this case will be :profile FIRSTGRADE location here age 23 color brown sport n/a firstname Amy lastname Cako middlename M school n/a job n/a END profile SECONDGRADE location there age 24 color white sport n/a firstname James lastname Don middlename M school n/a job n/a END profile THIRDGRADE location here age 29 color brown sport n/a firstname Amy lastname Mando middlename S school n/a job n/a END
the order within the input file might change line before the other . Can someone help?firstname : James lastname : Don middlename : M
open ( input , "<input.doc" ) or die " couldn't "; while (<input>) { if(m/$grade/) { $subLine = $_ } } # not sure
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: greping inside a file
by Plankton (Vicar) on Jan 19, 2004 at 21:41 UTC | |
by Anonymous Monk on Jan 19, 2004 at 21:53 UTC | |
|
Re: greping inside a file
by pg (Canon) on Jan 19, 2004 at 21:38 UTC | |
|
Re: greping inside a file
by jweed (Chaplain) on Jan 19, 2004 at 21:43 UTC | |
by Anonymous Monk on Jan 19, 2004 at 21:55 UTC | |
|
Re: greping inside a file
by bart (Canon) on Jan 19, 2004 at 22:30 UTC |