in reply to Regular Expressions to ignore lines starting with #
Instead of using:
open FILE,"tnsnames.ora" or die $!; {local $/=undef; $_ = <FILE>; } close FILE;
open(FILE, '<', 'tnsnames.ora') or die "Cannot open tnsnames.ora for reading, stopped ",$!; my $tnsnames = ''; for (<FILE>) { next if /^#/; $tnsnames .= $_; } close FILE;
It will skip the lines beginning with # and add all the rest into the scalar $tnsnames.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular Expressions to ignore lines starting with #
by sauoq (Abbot) on May 19, 2003 at 18:43 UTC | |
by zengargoyle (Deacon) on May 19, 2003 at 18:49 UTC | |
by sauoq (Abbot) on May 19, 2003 at 20:22 UTC | |
by Skeeve (Parson) on May 20, 2003 at 07:00 UTC | |
by lanier (Initiate) on May 20, 2003 at 12:51 UTC |