Hi, I am trying to split the lines in a file into two halves (at the first space) each half going into an array. The code I have written is below. The print command is there to test that things worked correctly, but it only gives an error for each instance of the print command...
Use of uninitialized value within @uktrackname in print at /home/bob/Documents/scripts/perl/music_md5_compare.pl line 22 (#1) ---Code--- #!/usr/bin/perl use warnings; #use strict; #use diagnostics; # perl script to compare two files of md5 checksums #+and extract the lines which differ open (BHF_FILE, "</home/bob/tmp/md5music") or die "Could not open md5music: $!"; @bhffile = <BHF_FILE>; close (BHF_FILE); for (my $i = 0; $i <= $#bhffile; $i++){ $bhffile[$i] =~ m/(\s.+) ( .+)/; push @ukchecksum, $1[$i]; push @uktrackname, $2[$i]; } print @ukchecksum[0]; # Won't print - uninitialized value ??? print @uktrackname[0]; # Won't print - uninitialized value !!! ---Code--- What am I doing wrong? Many thanks, Bob -- openSUSE 11.2, Kernel 2.6.31.5-0.1-desktop, KDE 4.3.4 Intel Core2 Quad Q9400 2.66GHz, 4GB DDR RAM, nVidia GeForce 9200GS -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/