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;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.