If the code is actually as you state, then you are using [ twice which
would make the mask incorrect.
The lines 54/56 show the vairable as being encased in [] and in line 76 you
show [$mask] which would equate to /^[[2,A-Z]]/ which is not really what you
want.
 
Wags ;)

-----Original Message-----
From: Gary Luther [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 07:52
To: [EMAIL PROTECTED]
Subject: Selection Mask - 2nd Attemp


Since I didn't get a response yesterday I hope someone can help this
morning.
 
I have a statement that I am using to mask from the user some file names
that I am displaying (print) to him for a y or n decision.
There are many files and so I am trying to give him the option of specifying
the first letter of the filename and then mask whether he
gets to see the file based on the mask that he inputs. (For any ladies on
the list he/him is generic for user :-) whewwww!!)
 
This works just fine and is how I get the "mask" into the program.
First the reading of the mask from the command line:
 
     53 if ($ARGV[1]) {
     54     $mask = "[$ARGV[1]]";
     55 } else {
     56     $mask ='[2,A-Z]';  #default mask
     57 }
 
Here is the problem code. I can't seem to get $mask to work in the code
below.
If I substitute the following statement for 76 it works as I want.
 
if ($file =~ /^[2,A-Z]/) {
 
Now the code that seems to totally ignore it:
 
     75 foreach $file (@files) {
     76     if ($file =~ /^[$mask]/) {
     77         chomp($file);
     78         ($size, $name) = split(" ", $file);
     79         print "PRINT ([y],n,q): $file\n";
     80         $input=<STDIN>;

Why does it not resolve $mask?  Is there a different way around the problem?
... or have I just made a beginners mistake?
 
TIA
 
--
-------------------------------------------------------------------------
"They that can give up essential liberty 
   to obtain a little temporary safety 
   deserve neither liberty  nor safety."                      
 
-- Benjamin Franklin 
-------------------------------------------------------------------------
RRRRR                Gary Luther
RR  RR               SAF
RR  RR UTABEGAS      2500 Broadway
RR RR                Helena, MT 59602
RRRR                 [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
RR RR  ULE !!        
RR  RR               Visit our website at
RR   RR              http://www.safmt.org <http://www.safmt.org> 


Reply via email to