in reply to Code won't proceed after input.
BTW, the plus sign at 'S' just means your line is too long and has been wrapped. You can adjust your line length in your settings.#!/usr/bin/perl use strict; use warnings; print "Enter the file containing the sequence: "; my $filename = <STDIN>; chomp $filename; open my $FH, '<', $filename or die "Cannot open $filename: $!"; my @chars = qw(A C D E F G H I K L M N P Q R S T V W Y); my $length; my $char_regex = join q(), @chars; $char_regex = qr/[$char_regex]/; my %occ; while (my $line = <$FH>) { for my $char (split //, $line) { next unless $char =~ $char_regex; $length++; $occ{$char}++; } } print "AMINO ACID \t OCCURRENCE \t FREQUENCY\n"; for my $char (@chars) { $occ{$char} //= 0; print "$char \t\t $occ{$char} \t\t ", $occ{$char} / $length, "\n" +; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Code won't proceed after input.
by newbie1991 (Acolyte) on Jan 23, 2013 at 16:43 UTC | |
by choroba (Cardinal) on Jan 23, 2013 at 16:52 UTC |