Teen Programmers Unite  
 

 

Return to forum top

Perl hashes

Posted by grandsnafu [send private reply] at September 13, 2001, 10:36:54 PM

Is there any way to store a function type thing in a perl hash? for example:
%lengths = qw(month length($m)); Calling $length("month") just returns the string "length($m)", which isn't very helpful. Any ideas?

Posted by taubz [send private reply] at September 14, 2001, 10:06:12 AM

I'm not sure what you're trying to do.... but maybe using the eval command and writing your own subroutine (or maybe a module, which I know nothing about) would work.

- taubz

Posted by grandsnafu [send private reply] at September 14, 2001, 10:33:08 PM

yeah, i'll try using eval. thanks

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.