Use of uninitialized value $period的问题

大家好,我是个Perl的初学者,在用Perl来写让电脑作图的程序时,遇到了一个问题无法解决。当我用Windows的Command line来运行时,提示的错误信息如下:
Use of uninitialized value $period in substitution <s///> at graph_gp_select.pl line 8, <TMP> line 1.
Use of uninitialized value $period in concatenation <.> or string at graph_gp_select.pl line 14.
程序的代码如下:
#!/usr/bin/perl -w
# Read in the data from files
#reads inn serial number from Fortran run from file "tmp"
open TMP, "tmp";
my $title_text = <TMP>;
my $period = <TMP>;
$title_text =~ s/\s//g;
$period =~ s/\s//g;
close TMP;

my $plotfile = $title_text.'.txt';

my $outputfile =$title_text.'_conc_select.png';
$title_text = $title_text.'; period = '.$period; (Line 14)


open (GNUPLOT, '|pgnuplot') or die "open: $!"; (pgnuplot是我用的作图软件)

print GNUPLOT <<EOF;

set terminal png

set title "$title_text"
set pointsize 2.0
set xtic
set mxtics 0.1
set ytics
set y2tics
set mytics 5

set xlabel "time, a.u."
set ylabel "nr, NR, NO3-, NMR, NO3_set (au)"
set y2label "NIT2:NIT4 (au), promoter saturation ratio (psr)"  

set grid


set output 'graph_select.png'
plot "$plotfile" usi 1:2 title "nr" w lines, "$plotfile" usi 1:3 title "NR"  w lines, "$plotfile" usi 1:4 title "NO3-" w lines,  "$plotfile" usi 1:8 title "NMR"  w lines, "$plotfile" usi 1:9 title "NIT2:NIT4"  axes x1y2 w lines, "$plotfile" usi 1:10 title "psr"  axes x1y2 w lines, "$plotfile" usi 1:11 title "NO3_set"  w lines
set output "$outputfile"
plot "$plotfile" usi 1:2 title "nr" w lines, "$plotfile" usi 1:3 title "NR"  w lines, "$plotfile" usi 1:4 title "NO3-" w lines,  "$plotfile" usi 1:8 title "NMR"  w lines, "$plotfile" usi 1:9 title "NIT2:NIT4"  axes x1y2 w lines, "$plotfile" usi 1:10 title "psr"  axes x1y2 w lines, "$plotfile" usi 1:11 title "NO3_set"  w lines
EOF

#unlink ("tmp");


close (GNUPLOT) or die "close!";
请哪位朋友帮我查一下,谢谢了!

[ 本帖最后由 hys850415 于 2010-10-4 17:20 编辑 ]