\This code works while ( $line = <$fh>) { ($store, $quarter, $quarteryear, $dcount, $date, $status) = chompsplit($line); my $key = $quarter . "," . $quarteryear ; $count{$key}++; } ############################### New code example of what i am trying to do, yes passing string in subroutine $header = 'Total profit Submitted by Quarter'; $string = '$quarter . "," . $quarteryear' submain($header,$string); $header = 'Total loss Submitted by Quarter'; $string = $'quarter . "," . $quarteryear . "," $status' submain($header,$string); trying to use the string sub submain ($head,$str) { my ($head,$str) = @_; open my $fh, '<', $file or die "Could not open '$file' $!"; while ( $line = <$fh>) { ($store, $quarter, $quarteryear, $dcount, $date, $status) = chompsplit($line); my $key = $str ; is this even possible, i remeber doing it in some other language $count{$key}++; print $key; return; } Thanks for the help Michael