#!/usr/bin/perl use strict; use warnings; use IO::Prompt::Hooked; my %opts = ( message => 'Enter namen of input fasta file', default => 'chr.fa', validate => sub {-e $_[0]}, error => 'File does not exist', ); open my $FILE, '<', prompt(%opts); open my $out, '>', 'output.txt'; ...;
If your input file used the full afta spec, I would also recommend finding a module to parse it. Your code suggests that your file uses only a small part of the spec. In that case, your approach of parsing it with regular expressions is fine. However, I do see errors in both of your regexes. $header would always be a null string. $seq would contain the entire record. (I would need a copy of your file spec in order to suggest a correction.) Your second regex does not even compile. (probably a typo in your post).
In reply to Re: if user provide input file use that in open() function istead
by BillKSmith
in thread if user provide input file use that in open() function istead
by Uzma Shaikh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |