Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: how do i put an equasion in a variable

by cwest (Friar)
on Jun 29, 2000 at 23:06 UTC ( #20469=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $array = [ 5, 5 ];
    $array->[2] = sub { $array->[0] * $array->[1] };
    print &{$array->[2]}; # 25
    $array->[1] = 10;
    print &{$array->[2]}; # 50
    
  2. or download this
    $array->[2] = '$array->[0] * $array->[1]';
    print eval $array->[2];
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://20469]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2023-02-06 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (37 votes). Check out past polls.

    Notices?