Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: matching a defined lenght

by shigetsu (Hermit)
on Apr 23, 2007 at 12:46 UTC ( [id://611490]=note: print w/replies, xml ) Need Help??


in reply to matching a defined lenght

I'm not so sure whether I grasp the correct connotation of 'match' in that context. But, consider using:

use strict; use warnings; my $str = 'abc' x 10; if (length $str == 30) { print "\$str has length of 30\n"; }
or
print $str =~ /(.{30})/;

Former one succeeds if $str has a length of 30 characters. Latter one yields back the first 30 characters extracted from $str using a regular expression.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-24 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found