#!/usr/bin/perl -- use strict; use warnings; use diagnostics; use Data::Dumper(); Main( @ARGV ); exit( 0 ); sub Main { warn Dumper( Silenced('hello') ), ' '; warn '------' x 6; warn Dumper( Loudmouth('loud') ), ' '; warn '------' x 6; warn Dumper( Smooth('cop') ), ' '; } ## end sub Main sub Dumper { Data::Dumper->new( \@_ )->Indent(0)->Useqq(1)->Dump; } sub Silenced { no warnings 'uninitialized'; my @string_array = @_; my @string; my $basecount; my $pos; my $pos_score; my @temp_array; my %base_stat; 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"; } ## end foreach $pos (@string) } ## end foreach (@string_array) return \%base_stat; } ## end sub Silenced sub Loudmouth { my @string_array = @_; my @string; my $basecount; my $pos; my $pos_score; my @temp_array; my %base_stat; foreach (@string_array) { @string = split( //, $_ ); $basecount = 0; foreach $pos (@string) { $basecount++; $pos_score = ord($pos) - 33; warn Dumper( \%base_stat ), ' '; @temp_array = $base_stat{$basecount}; # line 124 push( @temp_array, $pos_score ); $base_stat{$basecount} = "@temp_array"; } ## end foreach $pos (@string) } ## end foreach (@string_array) return \%base_stat; } ## end sub Loudmouth sub Smooth { my %base_stat; for my $str (@_) { my $basecount = 0; for my $pos ( split( //, $str ) ) { $basecount++; my $pos_score = ord($pos) - 33; #~ $base_stat{$basecount} = $base_stat{$basecount} ." ". $pos_score; # loud $base_stat{$basecount} .= " ". $pos_score; # smooth } ## end for my $pos ( split( //...)) } ## end for my $str (@_) return \%base_stat; } ## end sub Smooth __END__ $ perl pm.897159.pl $VAR1 = {4 => " 75",1 => " 71",3 => " 75",2 => " 68",5 => " 78"}; at pm.897159.pl line 13. ------------------------------------ at pm.897159.pl line 14. $VAR1 = {}; at pm.897159.pl line 62. Use of uninitialized value $temp_array[0] in join or string at pm.897159.pl line 66 (#1) (W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl will try to tell you the name of the variable (if any) that was undefined. In some cases it cannot do this, so it also tells you what operation you used the undefined value in. Note, however, that perl optimizes your program and the operation displayed in the warning may not necessarily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program. $VAR1 = {1 => " 75"}; at pm.897159.pl line 62. $VAR1 = {1 => " 75",2 => " 78"}; at pm.897159.pl line 62. $VAR1 = {1 => " 75",3 => " 84",2 => " 78"}; at pm.897159.pl line 62. $VAR1 = {4 => " 67",1 => " 75",3 => " 84",2 => " 78"}; at pm.897159.pl line 15. ------------------------------------ at pm.897159.pl line 16. $VAR1 = {1 => " 66",3 => " 79",2 => " 78"}; at pm.897159.pl line 17.