in reply to Record Separator affecting Regex
If you really need to redefine the record seperator, you could do something like this:
#!/usr/bin/perl use strict; use warnings; $/ = ";\n"; { local $/ = "\n"; while (my $line = <DATA> ){ $line =~ s/^#[^\r\n]*//g; # get rid of any comments print "Query: $line\n" if ($line !~ /^\s+$/); } } __DATA__ # one comment # two comment # another comment insert into table_name values(1, 'testing 1 2 3'); # more comments insert into table_name values (2, 'test •');
Output:
Query: insert into table_name values(1, 'testing 1 2 3'); Query: insert into table_name values (2, 'test •');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Record Separator affecting Regex
by tadman (Prior) on Nov 07, 2002 at 19:56 UTC |