Greetings,
This is the multi line pattern in which I wish to match:
String 1.2.3.4.5.6
This is what I have:
==
#!/usr/bin/perl -w
my $file='./index.html';
open INFILE, $file or die "Can't open $file: $!";
while ()
{
if (/^\n
Hello Fellow Perlites,
I'm having difficulty parsing a file and could use some help here.
I've attached my code, output file, and sample job run.
Basically, I want to read an Oracle TNS file (tnsnames.ora) and list
the host name and service on that server based on this input file. A
sample TNS
Am Dienstag, 8. März 2005 17.20 schrieb William Melanson:
> Greetings,
Greetings too :-)
>
> This is the multi line pattern in which I wish to match:
>
>
> String 1.2.3.4.5.6
>
>
>
> This is what I have:
>
> ==
> #!/usr/bin/perl -w
>
> m
> This is the multi line pattern in which I wish to match:
>
>
> String 1.2.3.4.5.6
>
>
One way to solve this would be to read lines from the file and save
chunks of N lines (4 in this case) in a temp variable. Then your regex
would operate on enough of the file to have a chance of working.
On Tue, 8 Mar 2005 13:42:44 -0500, Dave Gray <[EMAIL PROTECTED]> wrote:
> > This is the multi line pattern in which I wish to match:
> >
> >
> > String 1.2.3.4.5.6
> >
> >
>
> One way to solve this would be to read lines from the file and save
> chunks of N lines (4 in this case) in a temp va
> > Something like (untested):
> >
> > my (@lines, $num) = ((), 4);
> > while () {
> > push @lines, $_;
> > shift @lines if @lines == $num+1;
> > print 'lines '.($.-$num+1).' to '.($.)." match\n"
> > if join('',@lines) =~ /regex goes here/;
> > }
> >
>
> That assumes that the pattern bei
Dave Gray wrote:
This is the multi line pattern in which I wish to match:
String 1.2.3.4.5.6
One way to solve this would be to read lines from the file and save
chunks of N lines (4 in this case) in a temp variable. Then your regex
would operate on enough of the file to have a chance of workin
On Tue, 8 Mar 2005 15:26:28 -0500, Dave Gray <[EMAIL PROTECTED]> wrote:
> > > Something like (untested):
> > >
> > > my (@lines, $num) = ((), 4);
> > > while () {
> > > push @lines, $_;
> > > shift @lines if @lines == $num+1;
> > > print 'lines '.($.-$num+1).' to '.($.)." match\n"
> > > i
> > my (@lines, $num) = ((), 4);
>
> You are assigning the list ((), 4) to @lines and nothing to $num. Perhaps you
> meant:
>
> my ( $num, @lines ) = ( 4, () );
>
> Or simply:
>
> my ( $num, @lines ) = 4;
Indeed, good catch.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comman