in reply to Re^2: How to interpolate CONSTANTS in Here docs?
in thread How to interpolate CONSTANTS in Here docs?
I'm not understanding the @{[]} syntax, although I do recognize the array index [], the hash {}, and the array @ -- can you explain what is going on, please?
The array index isn't an array index, the hash isn't a hash.
@{ } dereferences an array reference. ${ } dereferences a scalar reference. [ ] constructs an array refrence, \ constructs a scalar reference. So, instead of writing
This program does this and that with the @{[OUT_DIR]}. The filename is @{[OUT_FILENAME]} and the file suffix is @{[OUT_SUFXSTOR]}. Fields are separated with the @{[OUT_FIELDSEP]} character. Enter a val +ue between @{[VAL_MIN]} and @{[VAL_MAX]}.
as in BrowserUk's example, you could also write
This program does this and that with the ${\OUT_DIR}. The filename is ${\OUT_FILENAME} and the file suffix is ${\OUT_SUFXSTOR}. Fields are separated with the ${\OUT_FIELDSEP} character. Enter a valu +e between ${\VAL_MIN} and ${\VAL_MAX}.
The reference implementation in perl is the author's way of introducing ásbestos gélōs into the language, great fun and a good opportunity to distinguish yourself with expertise, once you grok cause and syntax.
Quick, what does ~@~ mean?
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
|
---|
In Section
Seekers of Perl Wisdom