CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [ahfeii] length() does not count square brackets as 2 chatacters: Edit Log



7stud
Enthusiast

Jan 15, 2013, 11:35 PM


Views: 894
Re: [ahfeii] length() does not count square brackets as 2 chatacters

Why do you use an example where counting is so difficult?


Code
 
use strict;
use warnings;
use 5.012;

my $str = 'a';
say length $str; #output is 1

What conclusions can you draw from that?


Code
$str ="[1]"; 
say length $str; #output is 3



(This post was edited by 7stud on Jan 15, 2013, 11:37 PM)


Edit Log:
Post edited by 7stud (Enthusiast) on Jan 15, 2013, 11:36 PM
Post edited by 7stud (Enthusiast) on Jan 15, 2013, 11:37 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives