Jason Balicki wrote:
> This should be a quickie, I hope:
>
> I'm parsing an array that contains things like Zap/1 Zap/2 Zap/3 ... etc.
>
> I'm only concerned with Zap/32 - Zap/47.
>
> Will this work:
>
> if (($zapdef eq "Zap/*") and ($zapdef eq
> "*[32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47]*")) {
> dostuff();
> }
No, it will not work correctly. First of all you are not using regular
expressions you are using the 'eq' operator which compares strings for
equality. To do what you want using a regular expression:
if ( $zapdef =~ m!^Zap/(?:3[2-9]|4[0-7])$! ) {
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/