hcherry has asked for the wisdom of the Perl Monks concerning the following question:
"my" variable $email masks earlier declaration in same scope at hcshort.pl line 26. syntax error at hcshort.pl line 15, near ") {" syntax error at hcshort.pl line 28, near "}" Execution of hcshort.pl aborted due to compilation errors. I intend to use sendmail more than once but I'm a newbie in perl so I don't understand why I'm getting a syntax error and why the ()and {} seem to be ignored.#!/usr/local/bin/perl -w use Email::Sender::Simple qw(sendmail); use Email::Simple; use Email::Simple::Creator; open (IN, 'top.log'); $input=<IN>; print $input; $lngth=length($input); print $lngth; $load = substr($input,16,4); print $load; $value=.1 if ($load > $value) { # print "$load greater than $value"; my $email = Email::Simple->create( header => [ To => '"Hardy Cherry" <hcherry@youngliving.com>', From => '"Hardy Cherry" <hcherry@youngliving.com>', Subject => "Load g", ], body => "$load greater than $value.\n", ); sendmail($email); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: understanding scope and () and {}
by ikegami (Patriarch) on Jan 27, 2011 at 18:06 UTC | |
|
Re: understanding scope and () and {}
by toolic (Bishop) on Jan 27, 2011 at 17:40 UTC |