kri54sub has asked for the wisdom of the Perl Monks concerning the following question:
How do I use variable interpolation within a range operator?
eg: <THIS WORKS>
Instead of the above relative hard coded path, I want to use a variable which can be interpolated within this range operator, as inwhile (<FH>) { print if ( (/Btree/../PSE:/) or (m#PROCESSING ../Btree.gz#) or (m#PROCESSING ../log.dummy-10-05-18-05.gz#) or (m#PROCESSING ../log.dummy-10-01-06-05.gz#) ) } ----------------------------------------------------
But this doesn't work. Any suggestion on this interpolation. I tried the `$input` as well.@ARGV = qw#../log.dummy-10-01-06-05.gz ../log.dummy-10-05-18-05.gz ../ +Btree.gz/#; foreach $input (@ARGV) { open (FH,"zcat $filename|") or die "Can't Open file: $!\n"; while (<FH>) { print if ( (/Btree/../PSE:/) or (m#PROCESSING ../$input#) ) } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: variable interpolation within a range operator
by kyle (Abbot) on Feb 26, 2008 at 03:25 UTC | |
by kri54sub (Initiate) on Feb 28, 2008 at 00:19 UTC | |
|
Re: variable interpolation within a range operator
by jwkrahn (Abbot) on Feb 26, 2008 at 04:40 UTC |