in reply to Re^3: skipping lines when parsing a file
in thread skipping lines when parsing a file
#!/usr/bin/perl -w use strict; =cut The script parses the targeting.gb file and creates a new file that contains removes the comment info. =cut open(my $in, "C:/Documents and Settings/mydir/Desktop/TARGETING.gb"); open(my $out, ">C:/Documents and Settings/mydir/Desktop/TARGET.gb"); my $state; while(my $line =<$in>){ if ($line=~/^([A-Z]+)/) { $state=$1; } print $out $line unless $state eq "COMMENT"; } close $in; close $out
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: skipping lines when parsing a file
by ssandv (Hermit) on Aug 20, 2009 at 17:46 UTC |