#!/usr/local/bin/perl # Jaime Prilusky, 2008 use strict; use warnings; use English; my $source_file = "unigene"; my $result_file = "unigene1"; open (SOURCE, $source_file) || die "cannot open \"$source_file\": $!"; open (RESULT, ">$result_file") || die "cannot open \"$result_file\": $!"; #Use a special variable to change the input record separator #to be "//\n" instead of \n #NOTE: this does not remove the record separator; #each multi-line $entry will end with "//\n" $INPUT_RECORD_SEPARATOR = "//\n"; my $entry; ENTRY: while ($entry = ) { #reads until //\n inclusive my @lines = split (/\n/, $entry); my $line; foreach $line (@lines) { if (substr ($line, 0, 8) eq 'SEQUENCE') { print RESULT "//\n"; next ENTRY; } print RESULT "$line\n"; } } $INPUT_RECORD_SEPARATOR = "\n"; # restore default record separator