The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 01-17-2008
cbkihong cbkihong is offline
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,490
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
Reply With Quote