in reply to Regular expression question

sub is_allowed { my $s = shift; return 1 if $s eq 'NONE'; my %allowed, %seen; @allowed{split /,/,'-config,-files,-params,-driverPath,-appPath,-b +atchPath'} = (); ### (incorrect line)return if !exists $allowed{$_} or $seen{$_}++ +foreach split /,/, $s; (!exists $allowed{$_} or $seen{$_}++) and return foreach split /, +/, $s; return 1; }
Upd: incorect "EXPR if COND for LIST" construction fixed

Replies are listed 'Best First'.
Re: Re: Regular expression question
by dave_the_m (Monsignor) on Apr 26, 2004 at 16:59 UTC
    return if !exists $allowed{$_} or $seen{$_}++ foreach split /,/, $ +s;
    That won't work as you can't have stacked statement modifiers.