#!/usr/bin/perl @files = ('18_6_6','18_6_7','18_6_8','18_7_1','18_7_2','18_7_3','18_7_4','18_7_5','18_7_6','18_7_7','18_7_8','19_1_2','19_1_3','19_1_4','19_1_5','19_1_6','19_1_7','19_1_8','19_2_2','19_2_3','19_2_4','19_2_5','19_2_6','19_2_7','19_2_8','19_3_1','19_3_2','19_3_3','19_3_4','19_3_5','19_3_6','19_3_7','19_3_8','19_4_1','19_4_2','19_4_3','19_4_4','19_4_5','19_4_6','19_4_7','19_4_8','19_5_1','19_5_2','19_5_3','19_5_4','19_5_5','19_5_6','19_5_7','19_5_8','19_6_1','19_6_2','19_6_3','19_6_4','19_6_5','19_6_6','19_6_7','19_6_8','19_7_1','19_7_2','19_7_3','19_7_4','19_7_5','19_7_6','19_7_7','19_7_8','20_1_2','20_1_3','20_1_4','20_1_5','20_1_6','20_1_7','20_1_8','20_2_2','20_2_3','20_2_4','20_2_5','20_2_6','20_2_7','20_2_8','20_3_1','20_3_2','20_3_3','20_3_4','20_3_5','20_3_6','20_3_7','20_3_8','20_4_1','20_4_2','20_4_3','20_4_4','20_4_5','20_4_6','20_4_7','20_4_8','20_5_1','20_5_2','20_5_3','20_5_4','20_5_5','20_5_6','20_5_7','20_5_8','20_6_1','20_6_2','20_6_3','20_6_4','20_6_5','20_6_6','20_6_7','20_6_8','20_7_1','20_7_2','20_7_3','20_7_4','20_7_5','20_7_6','20_7_7','20_7_8','21_1_2','21_1_3','21_1_4','21_1_5','21_1_6','21_1_7','21_1_8','21_2_2','21_2_3','21_2_4','21_2_5','21_2_6','21_2_7','21_2_8','21_3_1','21_3_2','21_3_3','21_3_4','21_3_5','21_3_6','21_3_7','21_3_8','21_4_1','21_4_2','21_4_3','21_4_4','21_4_5','21_4_6','21_4_7','21_4_8','21_5_1','21_5_2','21_5_3','21_5_4','21_5_5','21_5_6','21_5_7','21_5_8','21_6_1','21_6_2','21_6_3','21_6_4','21_6_5','21_6_6','21_6_7','21_6_8','21_7_1','21_7_2','21_7_3','21_7_4','21_7_5','21_7_6','21_7_7'); $GPOUT = 'f(x)=(x", "my_plot_file.plot"); print WAVE2 $OUT; close WAVE2; system("/usr/bin/gnuplot my_plot_file.plot"); } __END__ # by the following way we open a lot of processes at the same time. # That messes up in log file and takes the computer to its knees. # We do not want that. And the method above is 1000 times faster!!!! foreach $f(@files) { open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot"; GP->autoflush(1); print GP 'set xrange [1.3:1.62];', "\n"; $filename = $f . ".dat"; # starting values for parameters print GP 'A=0.65; B=22; C=1.7; V0=1.68;'."\n"; $GPOUT .= "fit f(x) \"$filename\" u 2:1 via A,B,C,V0" . "\n"; print $GPOUT; print GP $GPOUT; close GP }