in reply to FYI, changing $/ "on the fly"

Why are you changing it each time? Why not use this instead:
open(FILE, "<file1.txt") || die $!; { local $/ = "****"; my $a = <FILE>; chomp $a; push @array,$a; } { local $/= "####"; while (<FILE>) { chomp $_; push (@array, $_); } close (FILE); }


T I M T O W T D I

Replies are listed 'Best First'.
Re: Re: Fyi
by maddfisherman (Sexton) on Aug 23, 2001 at 22:03 UTC
    almost but that would produce an array like this
    @array = ("stuff", "stuff****more\nstuff", "the rest of the file")
    instead of:
    @array = ("stuff", "more\nstuff", "the rest of the file")
      Then put the two in the same scope and remove the second local...

      T I M T O W T D I
      A reply falls below the community's threshold of quality. You may see it by logging in.