in reply to Re: Splitting long file
in thread Splitting long file

Since you are reading line by line, the
if ( m/^\$\n$/ )
will never match.
Update: I am an idiot. This will hopefully teach me to pay closer attention to which $ is meant as end of line, and which is meant as literal $. (And I will start using \z in my regexps...)

Replies are listed 'Best First'.
Re: Re: Re: Splitting long file
by EvdB (Deacon) on Apr 08, 2004 at 12:42 UTC
    It does work because I have not chomped the line.

    However the second open is in the wrong place:

    ### WRONG ### while (<BIG>) { open OUT, ">outfile_" .$i++; if ( m/^\$\n$/ ) { ### CORRECT ### open OUT, ">outfile_" .$i++; while (<BIG>) { if ( m/^\$\n$/ ) {

    --tidiness is the memory loss of environmental mnemonics