Modifying Global Variableby Willman023 (Scribe)
|on Jan 08, 2003 at 17:19 UTC ( #225301=perlquestion: print w/replies, xml )||Need Help??|
Willman023 has asked for the wisdom of the Perl Monks concerning the following question:
Dear Fellow Monks,
I'm having quite a problem, using a function to alter a global variable. I'm hoping you guys can show me how to use a function to modify multiple variables. I'm trying to convert (YYYY-MM-DD HH:MM:SS) to unix time(seconds starting from 1970). I'm thinking about using Time::Local for the conversion. The error I'm getting before even trying to convert is:
Can't modify constant item in scalar assignment at calendar.pl line 276, near ""$year.$month.$day";"
I originally tryed just setting the date by using $date = "$year..."; but read one of Ovid's nodes on scope and tried main::date with no luck. Thanks alot in advance for any advice!
Perl - the breakfast of Champions!
Back to Seekers of Perl Wisdom