perl script to print to values in rows and columns

Hi guys I want to print the values by using this script but its giving the no of rows and columns as input instead of values
Would you plz help me on this

FILE- chr1.txt

1981 1
1971 1
1961 1
1941 1

perl script

#!/usr/bin/perl -w
$infile1 = 'chr1.txt';
$outfile3 = 'out3.txt';

open IN3, "< $infile1" or die "Can't open $infile1 : $!";
open OUT3, "> $outfile3" or die "Can't open $outfile : $!";

my %years;

while (<IN3>) {
chomp;
my $year = (split /\t/);
$years{$year}++;
}

foreach (sort keys %years) {
print OUT3 "$, $years{$} \n";
}

close IN3;
close oUT3;

I need to create a list of years, together with the number of
CDs released in that year.

my $year = (split /\t/)[0];

I for got define the column [0]

Good, looks like you figured it out. :slight_smile: