
peacengell
New User
Jan 20, 2013, 9:57 PM
Post #1 of 7
(372 views)
|
|
Hi any help please
|
Can't Post
|
|
hello I need help with this script #!/usr/bin/perl my %years; while (<STDIN>) { chomp; my $year = (split /\t/)[3]; $years{$year}++; } foreach (sort keys %years) { print "In $_, $years{$_} Cds were released. \n"; } I save this file ( Data_munging.pl) when i run it like this ( perl -w Datamunging.pl <cd.txt Here is the output: [root@cent Data_muning_perl]# perl -w ./Data_muning1.pl <cd.txt Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 1. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 2. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 3. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 4. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 5. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 6. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 7. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 8. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 9. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 10. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 11. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 12. Use of uninitialized value $year in hash element at ./Data_muning1.pl line 11, <STDIN> line 13. In , 13 Cds were released. [root@cent Data_muning_perl]# this is cd.txt: [root@cent Data_muning_perl]# cat cd.txt Dave's CD Collection 16 Sep 1999 Artist Title Label Released -------------------------------------------------------- Bragg, Billy Workers' Playtime Cooking Vinyl 1987 Bragg, Billy Mermaid Avenue EMI 1998 Black, Mary The Holy Ground Grapevine 1993 Black, Mary Circus Grapevine 1996 Bowie, David Hunky Dory RCA 1971 Bowie, David Earthling EMI 1987 6 Records [root@cent Data_muning_perl]# The real out put I'm looking for is : 1971 1 1987 1 1993 1 1996 1 1997 1 1998 1 any help why i'm getting this error please thanks:
|