AWallBuilder has asked for the wisdom of the Perl Monks concerning the following question:

Dear all, I am getting a new error regarding the PRINT function. I have never had this error and have gotten no clue from a bit of googling. Any help is appreciated.

Can't locate object method "PRINT" via package "IO::File" at addFeatInfo2clusterinfo.pl line 63.

use strict; use warnings; use Data::Dumper; my $in_clustInfo=$ARGV[0] || "output.clusterinfo"; open (IN,"<" ,$in_clustInfo); my %HoMS2lines; while (my $line=<IN>){ chomp $line; my @cols=split(/\t/,$line); my $clust_indx=$cols[0]; my $mz=$cols[2]; my $rt=$cols[15]; $HoMS2lines{$clust_indx}{mz}=$mz; $HoMS2lines{$clust_indx}{rt}=$rt; $HoMS2lines{$clust_indx}{line}=$line; } #print Dumper(%HoMS2lines); close(IN); ## my $in_featsInfo=$ARGV[1]; open (IN,"<" ,$in_featsInfo); my %HoMS1feats; while (my $line=<IN>){ chomp $line; my @cols=split(/\t/,$line); my $mz=$cols[5]; my $rt=$cols[6]; my $feat=$cols[4]; my $metab=$cols[10]; $HoMS1feats{$feat}{mz}=$mz; $HoMS1feats{$feat}{rt}=$rt; $HoMS1feats{$feat}{metab}=$metab; $HoMS1feats{$feat}{line}=$line; } close(IN); #print Dumper(%HoMS1feats); ## my $out="$in_clustInfo.featsadded.txt"; open (OUT,">",$out); ## my $mz_ppmWin=10; my $rt_win=10; foreach my $clust (keys %HoMS2lines){ my $mz=$HoMS2lines{$clust}{'mz'}; my $mz_win=($mz*$mz_ppmWin)/1000000; my $rt=$HoMS2lines{$clust}{'rt'}; foreach my $feat (keys %HoMS1feats){ my $ftmz=$HoMS1feats{$feat}{'mz'}; my $ftrt=$HoMS1feats{$feat}{'rt'}; my $ftmetab=$HoMS1feats{$feat}{'metab'}; if (($ftmz < $mz+$mz_win && $ftmz > $mz-$mz_win) && ($ +ftrt < $rt+$rt_win && $ftrt > $mz-$rt_win)){ PRINT OUT join("\t",$HoMS2lines{$clust}{'line' +},$feat,$ftmz,$ftrt,$ftmetab)."\n"; } else{ PRINT OUT join("\t",$HoMS2lines{$clust}{'line' +},"no matchin feat","NA","NA","NA")."\n"; } } }

Replies are listed 'Best First'.
Re: Can't locate print error
by choroba (Cardinal) on Dec 03, 2015 at 10:18 UTC
    Perl is case sensitive. PRINT and print are two different strings. You wanted to use print.
    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        Indirect object notation. Method names aren't checked for existence before runtime.
        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re: Can't locate print error
by marto (Cardinal) on Dec 03, 2015 at 10:19 UTC

    The PRINT OUT... lines should be print OUT..., print in lower case, like your commented out examples of using print.

      oops sorry. I was progrming in another language for a few months, and I guess forgot a few things. thanks