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

Hello, this error pops up when I run my code : " Bad name after txt' at line 27 ..." I ran this code before in another machine and it worked so I know the function I'm using isn't the problem , or the syntax, also tried changing the file name and location but that doesn't do anything. Can someone tell me what I should modify or what I am doing wrong? Thanks in advance :)
use strict; use warnings; use PDL; use PDL::IO::Misc; use PDL::NiceSlice; open my $in, '<', 'BN_Fc_26_Ac_8.dat' or die "Can't read old fi +le: $!"; open my $out, '>', 'datosF26A8.txt' or die "Can't write new file: $!"; + my %s; my %rms; my $c; { while(<$in>){ next if /^\#/; my @datos=split; my $a=sprintf("%.1f",$datos[4]); my $f=sprintf("%.1f",$datos[5]); $s{$a}{$f}=$datos[0]; $rms{$a}{$f}=$datos[1]; } foreach my $amp (sort {$a <=> $b} keys %s){ foreach my $frq (sort {$a<=>$b} keys %{$s{$amp}}){ say $out join " ",$amp,$frq,$s{$amp}{$frq},$rms{$amp}{$frq};} say $out; } } ($c) =PDL->rcols'datosF26A8.txt',[]; print $c;

Replies are listed 'Best First'.
Re: Bad name after
by Corion (Patriarch) on Dec 27, 2022 at 16:35 UTC

    Line 27 is:

    ($c) =PDL->rcols'datosF26A8.txt',[];

    Most likely you want parentheses around the filename:

    ($c) =PDL->rcols('datosF26A8.txt',[]);
      oh, thank you !