On 1/5/06, chen li <[EMAIL PROTECTED]> wrote:
> Each record starts with ">". I want to read each
> record once at a time.I hear about a special variable
> call $/ might do the job but not sure how to use it.

The perlvar manpage documents $/ and all of Perl's other special
variables. In particular, this variable contains a string ("\n" by
default) which Perl expects to come at the end of every "line" of
input.

Although it's tempting to set $/ to "\n>" for the file format you
describe, that's probably not correct for the first or last record in
your file. I recommend that you write code to identify each record
(with regular expressions, perhaps?) instead of using $/.
Alternatively, you could pre-process the data file in some way so that
using $/ would be a good solution.

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to