Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: =~ matches non-existent symbols

by ikegami (Pope)
on Nov 18, 2014 at 17:38 UTC ( #1107606=note: print w/replies, xml ) Need Help??


in reply to Re: =~ matches non-existent symbols
in thread =~ matches non-existent symbols

What a waste. This will slow down the program by so much and it'll use up so much more memory than needed. You could simply use
use strict; use warnings; my $bad = 0; while (<>) { if (!/^[actg]+$/i) { ++$bad; last; } } print $bad ? "BAD\n" : "OK\n";

Replies are listed 'Best First'.
Re^3: =~ matches non-existent symbols
by rnewsham (Curate) on Nov 18, 2014 at 22:34 UTC

    You are correct, I had not considered how inefficent that method is. Thanks for pointing it out.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1107606]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2021-10-20 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (80 votes). Check out past polls.

    Notices?