> 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.

  Using strict mode, you should declare the variables scope with my for example…

-- 
Olivier Le Monnier — ☎ 023156.6209 
Administrateur systèmes libre(s) 
Direction du Système d'Information 
Université de Caen Normandie 


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to