use warnings; use strict; &readfile; sub readfile{ my $input_FL; my @file_row; my @row_text; my $row_data; my $row_text; my $line =0; my $status; my $soc; my $subscriber; my @ar_OR_STA; my @ar_OR_SOC; my @ar_OR_SUB; $input_FL = "C:\\taj.txt"; chomp $input_FL; #remove enter key or any spaces open(IN_FL, $input_FL) || die ("unable to open directory"); while (){ @file_row=; print $#file_row; }#while close IN_FL; foreach(@file_row) { while ($line < $#file_row +1){ $row_data =$file_row[$line]; chop ($row_data); next unless /\S/; # only use lines that contain +something else than spaces #print "$row_data\n"; if ($row_data =~ /^[d]/) { $status = $row_text[0]; $status =~ s/(\W+)/ /gs; #Eliminate all non-+word characters followed by space. #$ar_OR_STA[$i]=$status; #Here $[=1, so @ar_STA[0] does not have any value. Original Array of Status push (@ar_OR_STA,$status); print "@ar_OR_STA\n"; $soc = $row_text[1]; $soc =~ s/(\W+)/ /; #Eliminate all non-word characters followed by space. #$ar_OR_SOC[$i-1]=$soc; #Here $[=1, so @ar_STA[0] does not have any value. Original Array of Status $subscriber = $row_text[3]; $subscriber =~ s/(\D+)/ /; #Eliminate all non-digits followed by space. #$ar_OR_SUB[$i-1]=$subscriber; #Here $=1, so @ar_SUB[0] does not have any value.Original Array of Subscriber } else { print " File is invalid\n"; } $line++; }#while }#foeach } # Here, I get Uninitaialized value in substitution(s///) in the following lines?Anybody Know why? $status =~ s/(\W+)/ /gs; $soc =~ s/(\W+)/ /; $subscriber =~ s/(\D+)/ /; # and use of initialized value in join or string at print "@ar_OR_STA\n";