use 5.012.02;
use strict;
use warnings;
my %base_stat;
my @temp_array;
my $basecount;
my @string;
my @string_array = qw/this that and all manner of other/;
my $pos;
my $pos_score;
foreach (@string_array){
@string=split(//,$_);
$basecount=0;
foreach $pos (@string){
$basecount++;
$pos_score=ord($pos)-33;
@temp_array=$base_stat{$basecount}; # line 124
push (@temp_array,$pos_score);
$base_stat{$basecount}="@temp_array";
}
}
say "\%base_stat contains:";
foreach my $key ( sort keys %base_stat ) {
say "$key => $base_stat{$key}";
}
####
Use of uninitialized value $temp_array[0] in join or string at test.pl line 26.
Use of uninitialized value $temp_array[0] in join or string at test.pl line 26.
Use of uninitialized value $temp_array[0] in join or string at test.pl line 26.
Use of uninitialized value $temp_array[0] in join or string at test.pl line 26.
Use of uninitialized value $temp_array[0] in join or string at test.pl line 26.
Use of uninitialized value $temp_array[0] in join or string at test.pl line 26.
%base_stat contains:
1 => 83 83 64 64 76 78 78
2 => 71 71 77 75 64 69 83
3 => 72 64 67 75 77 71
4 => 82 83 77 68
5 => 68 81
6 => 81
####
use 5.012.02;
use strict;
use warnings;
my @input_string_array = qw/this that and all manner of other/;
my @output_array;
foreach my $string ( @input_string_array ) {
push @output_array, join " ", map { ord($_) - 33 } split //, $string;
}
say $_ for @output_array;
####
use 5.012.02;
use strict;
use warnings;
my @input_string_array = qw/this that and all manner of other/;
my %output_hash;
foreach my $iterator ( 0 .. $#input_string_array ) {
$output_hash{ $iterator + 1 } = join " ", map { ord($_) - 33 } split //, $input_string_array[$iterator];
}
foreach my $key ( sort keys %output_hash ) {
say "$key => $output_hash{$key}";
}