Anton Leontiev Anton Leontiev - 9 months ago 29
Perl Question

Need help in Perl

I don't know Perl but now I need to correct Perl script, so I hope you can help me.
I have a Perl script which allows to process files with the next structure of name: CCCCNNNN.16X, where CCCC - 4 characters, NNNN - 4 numbers and X might be "o" or "n", for example, bshm1930.16o.
This script creates command for Linux command line but it doesn't pick files correct. As I understand, the problem is in this part of code:

# add ephemeris file
$ephfile = $rawfile;
$ephfile =~ s/$stationID/bshm/;
$ephfile =~ s/\.([90][0-9])o/.$1n/;
push @opt, "--nav $ephfile";

Here I need to chose file of type *.16n, but code returns *.16o. What should I change to obtain file with 16n extension, not 16o?
Thank you in advance!

simbabque, thank you


The regular expression pattern in your substitution does not match 16.


This will match a nine or a zero followed by one any number, followed by an o, and then replace it with a dot, the two digits, and an n.

See the explanation on