"John W. Krahn" wrote: > > > Try it like this: > > > > > > perl -le 'print eval "@ARGV"' > > > > Good on 'nix/'nux, I guess. On Windows, It takes a little different quoting: > > You mean like: > > perl -le "print eval [EMAIL PROTECTED]" > > > Greetings! E:\d_drive\perlStuff>perl -le "print eval $ARGV[0]" "2 + 3" > > 5 > > No, I guess you didn't. > > > What happens is simply that the eval @ARGV statement calls the count of elements, > > Are you implying that an array in a double quoted string is in scalar > context? (To the beginners out there, an array in a double quoted > string expands to all the elements of the array separated by the > contents of the $" variable.)
I'm missing something here, John. Of what significance is the array to the OP? I did misstate the adjustments made to the code. The original code pasted in had the array, and rendered nothing. I should have pointed out, I guess, that this was the nub of the problem. The quoting issues are actually adjustments made for different [not better or worse, just different] command-line syntaxes. The core issue, IMHO, is that we were hitting on an array for what was essentially a scalar problem--to get the arithmetic result of a single expression from the command line. For the OP, here are two approaches to the problem as posted, with heed given to the warning about using a regex where a string belongs. I made the string empty, also, since no human has to read the resulting expression. Greetings! E:\d_drive\perlStuff>perl -e "print eval $ARGV[0]" "79872593 * 67" 5351463731 Greetings! E:\d_drive\perlStuff>perl -e "print eval join '', @ARGV" "79872593 * 67" 5351463731 I showed a solution that achieves the desired result, and the attendant successful output, from the Windows command line. Could you do likewise for 'nix? Thanks, Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]