Closed p5pRT closed 20 years ago
when using a given statement. given ("asdf") { when /r.*/ { } }
the having a string match on when doesn't work. it's documented that it does though. i changed all my given's to switch and when's to case and it works fine.
On Sat\, Sep 04\, 2004 at 03:15:24AM -0000\, brendon @ brendon. com wrote:
when using a given statement. given ("asdf") { when /r.*/ { } }
The following works for me:
use Switch 'perl6';
given ("asdf") { when /a.*/ { print "matched\n" } }
Could you give a complete (but short!) example of a program which fails?
Dave.
-- The Enterprise successfully ferries an alien VIP from one place to another without serious incident. -- Things That Never Happen in "Star Trek" #7
The RT System itself - Status changed from 'new' to 'open'
I ended up fixing the problem.
I think the problem was that I had the when/given statement within a sub. Once moved out to the main program\, I think it worked.
Maybe the problem was that the use switch perl6 doesn't give an error about it and when I tried the perl5 case statement instead\, I got a better error?
sorry if that's not it\, but I working off memory :)
-bb
-----Original Message----- From: Dave Mitchell via RT [mailto:perlbug-followup@perl.org] Sent: Tuesday\, September 14\, 2004 4:08 PM To: brendon@brendon.com Subject: Re: [perl #31445] use switch 'perl6' string matching
On Sat\, Sep 04\, 2004 at 03:15:24AM -0000\, brendon @ brendon. com wrote:
when using a given statement. given ("asdf") { when /r.*/ { } }
The following works for me:
use Switch 'perl6'; given \("asdf"\) \{ when /a\.\*/ \{ print "matched\\n" \} \}
Could you give a complete (but short!) example of a program which fails?
Dave.
-- The Enterprise successfully ferries an alien VIP from one place to another without serious incident. -- Things That Never Happen in "Star Trek" #7
@rspier - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#31445 (status was 'resolved')
Searchable as RT31445$