strange syntax: $var'token

M

Michael Vilain

I have the O'Rielly Camel book and didn't find any reference to the
following syntax I saw in some code for a web store:

$cgi_lib'filepre = "cgi-lib";

Is this some sort of shorthand for

$cgi_lib['filepre'] = "cgi-lib";

I'm used to using perl 5.0 but don't know if this an addition in later
versions (5.[68]). Is it?

TIA...
 
J

Joe Smith

Michael Vilain said:
I have the O'Rielly Camel book and didn't find any reference to the
following syntax I saw in some code for a web store:

$cgi_lib'filepre = "cgi-lib";

That is perl4 syntax for setting the variable $filpre in package cgi_lib.
For perl version 5.x, use :: instead of ' after the package name.

$cgi_lib::filpre = 'cgi-lib';

I would not trust code like that as a web store or shopping cart.

If you have any other questions, post them to comp.lang.perl.misc
not here (comp.lang.perl).
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top