Friday, June 10, 2005

Using eval

Here is some recursive(?) cool usage of eval.Thanks to Chandra..

$p=i
$i=1
$CM1=World
$CM=Hello
$eval HOST=\$CM\$$p
$echo $HOST
Hello1
$eval HOST=$CM\$CM$i
$echo $HOST
HelloWorld
$eval HOST=\$CM$i
$echo $HOST
World

0 Comments:

Post a Comment

<< Home