Why am I in this thread? Please remove me from it
Sent from my iPhone > On Nov 25, 2015, at 7:13 PM, Jin Xu <j...@celestica.com> wrote: > > Try to use below updated ones: > > #!/usr/bin/perl > use strict; > use warnings; > while (my $line = <>) { > while ($line =~ > s#\d+\s*[*+-/]\s*\d+(\s*[*+-/]\s*\d+)*#<x>#) { > my $result; > eval ("$result = $&;"); > $line =~ s/<x>/$result/; > > } > print ($line); > } > > > > Regards, > Jin Xu > > > > 2015-11-25 23:09 GMT+08:00 Gary Baker <garybak...@gmail.com>: >> gb@MINT ~/Perl5/perl programs $ cat prog164.pl >> #!/usr/bin/perl >> use strict; >> use warnings; >> while ($line = <>) { >> while ($line =~ >> s#\d+\s*[*+-/]\s*\d+(\s*[*+-/]\s*\d+)*#<x>#) { >> eval ("\$result = $&;"); >> $line =~ s/<x>/$result/; >> >> } >> print ($line); >> } >> >> >> >> gb@MINT ~/Perl5/perl programs $ ./prog164.pl >> Global symbol "$line" requires explicit package name at ./prog164.pl line 4. >> Global symbol "$line" requires explicit package name at ./prog164.pl line 5. >> Global symbol "$line" requires explicit package name at ./prog164.pl line 8. >> Global symbol "$result" requires explicit package name at ./prog164.pl line >> 8. >> Global symbol "$line" requires explicit package name at ./prog164.pl line 11. >> Execution of ./prog164.pl aborted due to compilation errors. >> gb@MINT ~/Perl5/perl programs $ >> >> >> What is this error? And what am I doing wrong. >