@PERL[expression] definition?

May 31, 2008
62
0
Oklahoma
According to TakeCommand Help v.11:

@PERL[expression] : Executes the specified Perl expression (requires Active State Perl 5.10).
It's probably an artifact of my ignorance but I can't find answers for the following questions.

  1. Does @PERL block until expression is evaluated? i.e. Does TakeCommand/TCC wait until the Perl expression is evaluated?
  2. What return values (if any) are provided by @PERL?
TIA for any reference to a more complete definition of @PERL or any examples of usage. (I'm most baffled by Item 2! ;) )
 
May 20, 2008
11,292
95
Syracuse, NY, USA
definition?

On Wed, 04 Nov 2009 21:40:43 -0600, Bob Chapman <> wrote:

|1. Does @PERL block until expression is evaluated? i.e. Does TakeCommand/TCC wait until the Perl expression is evaluated?
|2. What return values (if any) are provided by @PERL?

Being a variable function, @PERL[] will be embedded in a TCC command. The
variable function will be evaluated, it's value substituted in the command line,
and the command executed. The actual value of the variable function will
typically be a number returned by PERL indicating success or failure. Usually
one is interested in the effect of eveluating @PERL[] rather than its "value".
I'm confident you'll get better explanations. Example:

Code:
v:\> set rv=%@perl[$a = 'rekcaH lreP rehtonA tsuJ'; $a = reverse($a);
printf "$a\n"]

Just Another Perl Hacker

v:\> echo %rv
1
--
- Vince
 
May 31, 2008
62
0
Oklahoma
Re: @PERL definition?

The actual value of the variable function will typically be a number returned by PERL indicating success or failure.
Thanks for the reply!
Experimentation (for at least one case ;)) suggests that @PERL will return the value of a perl expression provided that the value is an integer (and with the assumption that 'false' is returned as '0'):
Code:
> echo ^|%@perl[$a='aaaabcccdd';$a=~s/z//g;]^|
|0|
> echo ^|%@perl[$a='aaaabcccdd';$a=~s/a//g;]^|
|4|
> echo ^|%@perl[$a='aaaabcccdd';$a=~s/b//g;]^|
|1|
> echo ^|%@perl[$a='aaaabcccdd';$a=~s/c//g;]^|
|3|
> echo ^|%@perl[$a='aaaabcccdd';$a=~s/d//g;]^|
|2|
However, since any return value for @PERL is AFAIK undocumented, I don't know if this behavior is an anomaly or if it can be expected for other perl expressions returning integers. :confused:
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Documentation TPIPE, /perl, DotMatchesNewLines Support 1
David McClelland TCMD 24 & Perl - perl thinks it's own executable is ...\TCMD24\TCC.EXE??? Support 3
vefatica Embedded perl and stdout? Support 9
jbanaszczyk Non ActiveState Python/Perl Support 4
R How to? use @everything perl regex Support 2
vefatica TPIPE's /perl option? Support 1
I perl output is not visible Support 4
mikea Perl and tcc (redux) Support 7
mikea How to? TCC 15: popup windows; launching Perl scripts Support 10
M Missing PERL command-line arguments Support 1
David McClelland Perl/Tk problem with TCC (13&14) Support 3
D Documentation @PERL Support 6
epement Strawberry Perl batch file errors Support 15
David McClelland Invoking TCC FROM Perl 5.12 Support 3
M @Perl on 64bit W7 Support 7
L redirection to/by perl acts bizarrely Support 9
B Perl not working Support 8
J How does tcc search for perl*.dll Support 1
H TTC Equivalent to Perl `One-Liner' Support 3
vefatica 9.02.156 and Perl Support 4
J @PERL and ^C Support 4
D How to? Use regular expression with REN? Support 2
R v25 Regular Expression Analyser Support 2
vefatica SET /A var=expression=digits Support 3
D conditional expression: force numeric Support 6
D Catching the result of an evaluated script expression Support 0
rps Documentation Regular expression syntax link broken Support 1
WadeHatler Fixed Breaking change in Expression evaluation (.and.) in v17 Support 6
Joe Caverly Conditional Expression Test of @SFN Support 4
cgunhouse Trouble with Relational Expression Support 4
M How to? Do a particular regular expression... Support 8
JohnQSmith Regular expression groups Support 15
M Just a verification regarding "Iff" and both "status test(s)" and "relational expression(s)"... Support 3
A How to? filter text stream with a regular expression Support 11
Phileosophos Can FFIND match file names with a regular expression? Support 19
fpefpe regular expression -- caseless Support 3
nickles Regular expression FOR/DIR Support 2

Similar threads