![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ! operator in variable | mmunir | Shell Programming and Scripting | 1 | 05-30-2008 12:29 AM |
| perl scalar variable in backquoted string | mehdi9 | Shell Programming and Scripting | 6 | 10-09-2007 11:33 AM |
| what is diff b/w copy constructor and overloaded assignment operator | amitpansuria | High Level Programming | 3 | 08-06-2007 12:45 PM |
| Can't modify not in scalar assignment compilation error | new2ss | Shell Programming and Scripting | 2 | 05-18-2006 02:03 AM |
| @ in a variable assignment | rkap | UNIX for Dummies Questions & Answers | 1 | 05-23-2005 07:53 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
scalar variable assignment in perl + { operator
When reading over some perl code in a software document, I came across an assignment statement like this
$PATH = ${PROJECT}/......./.... In this particular form of scalar variable assignment, what does the curly braces operators do ? Also, what is the benefit in doing scalar assignment this way ? many thanks |
| Forum Sponsor | ||
|
|
|
|||
|
Surrounding the identifier with curly braces is more frequently seen in double-quoted strings to separate it from neighbouring text. For example,
"The time now is ${time}A.M." This syntax also works outside strings, as you cited, but that is rarely needed and being most of the time redundant. It is there to support identifiers that start with a ^ sign, which is normally not allowed. However, I cannot think of any case that really needs to refer this kind of variables. For more information, refer to perlvar - perldoc.perl.org |