Connecting Tech Pros Worldwide Forums | Help | Site Map

PERL Variable names, Significant Length

Newbie
 
Join Date: Aug 2009
Posts: 2
#1: Aug 7 '09
Hello everyone,

I'm new to PERL and i just wanted to ask how many are the significant initial characters in naming a variable in PERL. I know that a variable has a maximum name length of 255, but how many of these are significant.

In C for instance,
<quote>
63 significant initial characters in an internal identifier or a macro
name (each universal character name or extended source character is
considered a single character)
— 31 significant initial characters in an external identifier
< end quote>

numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,572
#2: Aug 7 '09

re: PERL Variable names, Significant Length


Quote:

Originally Posted by robokevs009 View Post

Hello everyone,

I'm new to PERL and i just wanted to ask how many are the significant initial characters in naming a variable in PERL. I know that a variable has a maximum name length of 255, but how many of these are significant.

In C for instance,
<quote>
63 significant initial characters in an internal identifier or a macro
name (each universal character name or extended source character is
considered a single character)
— 31 significant initial characters in an external identifier
< end quote>

You should take a read of the perldata language reference page. It should answer your questions.

Regards,

Jeff
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#3: Aug 8 '09

re: PERL Variable names, Significant Length


On my Vista 64 bit with strawberry perl 5.10 I can use a scalar with 257 characters (not including the $ at the beginning). At 258 I get the "identifier too long" error.
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,572
#4: Aug 8 '09

re: PERL Variable names, Significant Length


Quote:

Originally Posted by KevinADC View Post

On my Vista 64 bit with strawberry perl 5.10 I can use a scalar with 257 characters (not including the $ at the beginning). At 258 I get the "identifier too long" error.

He he, you tried it, didn't you? :)
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#5: Aug 8 '09

re: PERL Variable names, Significant Length


Quote:

Originally Posted by numberwhun View Post

He he, you tried it, didn't you? :)

I'm guilty. May I be punished now?

Reply