[esp-r] Re: Scripting and Perl

Gian Luca Brunetti gianluca.brunetti at polimi.it
Tue Oct 29 16:32:03 GMT 2013


Hi Amar,
when you'll take at look at Perl after you'll have studied some example shell scripts, you'll see that the input to the shell is (comparatively) easy with Perl, because of Perl's capability of variable interpolation (like Ruby, for instance).

Basically, you have to print to the shell what you would type to the keyboard.

The following script for example will move a zone:

print `prj -file $file -mode script<<YYY

m
c
a
$zone
i
e
$x_movement $y_movement $z_movement
y
$yes_or_no
-
y
c
-
-
-
-
-
-
-
-
YYY
`;

The backquotes makes you enter the shell and exit from it.

The advantage of Perl over, say, Python in this case is that variables are named instead of attributed by position (order); which may make the scripts look clearer.

About the CSV output with Perl, I think that basically it is a matter of printing (items separated by commas).

If you already have a table on a file, I think that you may convert it in csv format using regular expressions instead.

Best regards

Gian Luca Brunetti


________________________________________
From: esp-r-bounces at lists.strath.ac.uk <esp-r-bounces at lists.strath.ac.uk> on behalf of Amar Seeam <amar.seeam at strath.ac.uk>
Sent: Tuesday, October 29, 2013 3:42 PM
To: esp-r at lists.strath.ac.uk
Subject: [esp-r]  Scripting and Perl

Hi all,

I would like some help with scripting. Basically I would like to
automate runs based on various .cfg files and output the simulation data
in CSV format (for further processing and other perl scripts).

I have tried to read through the perl scripts in the source branch
(tester.pl ) but was wondering if there are any other supporting
documentation (...or simpler scripts) for this or if there are specific
command line switches I need to instantiate and run bps to generate the
CSV files as result output (with user specified columns as well).

Thanks in advance.

Amar.


_______________________________________________
esp-r mailing list
esp-r at lists.strath.ac.uk
http://lists.strath.ac.uk/mailman/listinfo/esp-r



More information about the esp-r mailing list