Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: =~ matches non-existent symbols

by ikegami (Patriarch)
on Nov 18, 2014 at 17:38 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found