in reply to Re^2: Perl Parser, need help
in thread Perl Parser, need help

I did mention that it was untested.

That line is missing a terminating semicolon, fixed.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^4: Perl Parser, need help
by joomanji (Acolyte) on Jun 02, 2005 at 07:26 UTC
    Hi QM.. thanks for everything! After some modification on the matching of the "Sequence : Contig.." part, the script finally working! I disable the warning output, so it looks abit nicer when running the script.. here is the modified one. Thank u again QM! And thanks to everyone who helped!

    #!/bin/perl/
    my $sequence;

    while (my $line = <>)
    {
    # Sequence keyword
    if ($line =~ /^Sequence:\s+(\S+)/)
    {
    $sequence = $1; # save the sequence
    next;
    }

    # Parameter keyword
    next if ($line =~ /^Parameters:\s+(.*)$/);

    # print any other non-blank lines
    if ($line != /^\s+$/)
    {
    print "$sequence $line";
    next;
    }
    }

    Thanks again everyone!
      I disable the warning output, so it looks abit nicer when running the script.
      You mean you removed strict and warnings ???

      I can't check it where I am right now, but I don't see anything that would cause you problems, unless you're running on a very old or customized Perl.

      Perhaps you could relate what warnings you're getting, and we might convince you to put strict and warnings back in? Or perhaps it's related to your larger script, and not to this minimal example?

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of