-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathascii2num
51 lines (34 loc) · 795 Bytes
/
ascii2num
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl -w
#
# ascii2num.pl -- Convert ASCII codes to numbers.
#
# Author: Nowind
# Created: 2010-09-29
# Updated: 2015-06-11
# Version: 1.0.0
#
# Change logs:
# Version 1.0.0 15/06/11: The initial version.
use strict;
use Bio::SeqIO;
######################## Main ########################
my $CMDLINE = "perl $0 @ARGV";
my $VERSION = '1.0.0';
my $HEADER = "##$CMDLINE\n##Version: $VERSION\n";
my ($input) = @ARGV;
unless( $input ) {
print <<EOF;
$0 -- Convert ASCII codes to numbers.
Version: $VERSION
Usage: perl $0 <ASCII string>
EOF
exit(1);
}
my @ascii_codes = split //, $input;
my @numbers = ();
for (@ascii_codes)
{
push @numbers, ord($_);
}
###print STDOUT join "\t", @ascii_codes, "\n";
print STDOUT join "\t", @numbers, "\n";