In addition to other problems commented upon, I see a couple more: you're using prototypes (improperly); you're not using warnings and strictures (see strict).
Abandoning the use of prototypes until you understand what they do (and that you should almost never use them) will save you great and needless suffering. Using warnings and strictures will initially cause additional pain, but it will be a healing pain! Addressing the problems that warnings and strictures bring to light will ultimately make your code more robust.
c:\@Work\Perl\monks>perl -le "use warnings; use strict; ;; my $filename; ;; Grab($filename); ;; $filename = 'too late'; ;; sub Grab($filename){ print qq{filename is '$filename'}; my @ra = (9, 8, 7); print 'it matches!' if @ra =~ m{ 3 }xms; } " Illegal character in prototype for main::Grab : $filename at -e line 1 +. Applying pattern match (m//) to @array will act on scalar(@array) at - +e line 1. main::Grab() called too early to check prototype at -e line 1. Use of uninitialized value $filename in concatenation (.) or string at + -e line 1. filename is '' it matches!
In reply to Re: Catching expressions from a file
by AnomalousMonk
in thread Catching expressions from a file
by kepler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |