in reply to multiple "newline" delimiters

Well, you can read in the whole thing, and then split it - this would probably be my approach, although there are probably better out there:
my $data; $data .= $_ while (<>); my @code = split(/[;\/]/, $data); for my $line (@code) { ... }

Good luck,
  -Adam

Replies are listed 'Best First'.
Re^2: multiple "newline" delimiters
by lgordoncurtis (Initiate) on May 31, 2005 at 17:47 UTC
    That's kinda what I'm leaning towards doing right now, but it seems very memory-wasteful. A similar idea i had is to slurp in the file, replace all the '/' with ';' and then go back to parsing a new temp file. The major problem with just splitting on ';' or '/' is dealing with procedures (see sample code), which I've made a work-around for by reading in line by line.
    create or replace procedure myProc as begin select * from whatever; end;
    As you can see, those types of PL/SQL statements have multiple ';'s but are technically one statement. But I've got a messy work-around where I match up begins and ends for that. Just so people know what problem I'm working with, here's some sample data:
    delete from mytable where my_id='12345' / insert into anothertable values ('123456','somedata'); /