kidd has asked for the wisdom of the Perl Monks concerning the following question:
Recently I've been learning Java, and right now im looking at how Java variables work.
For example, when you initialize a variable in Java you must first define what kind of values that variable can hold:
int i = 10; short s = 24000;
When you initialize a variable, Java makes a block of space in the memory for that variable knowing how much space it can hold.
But in perl, we have a "universal" variable, for example a string ($) can hold ints, strings, floats, almost anykind of data. So you can do something like this:
my $stringa = 1234; $stringb = "Hello"; $stringa = $stringb; #No cast problem
Knowing this, my question is: How does perl work with variables?
I've been thinking that when perl makes some space for a variables, it still has to keep in mind that the variable might change in size.
I tried to find some article on the web, but without success.
THANKS
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Behind the Scenes - Perl Variables
by Ovid (Cardinal) on Apr 19, 2005 at 18:59 UTC | |
Re: Behind the Scenes - Perl Variables
by dragonchild (Archbishop) on Apr 19, 2005 at 19:00 UTC | |
Re: Behind the Scenes - Perl Variables
by johnnywang (Priest) on Apr 19, 2005 at 19:27 UTC | |
Re: Behind the Scenes - Perl Variables
by Joost (Canon) on Apr 19, 2005 at 19:31 UTC | |
Re: Behind the Scenes - Perl Variables
by sasikumar (Monk) on Apr 19, 2005 at 18:59 UTC | |
Re: Behind the Scenes - Perl Variables
by bofh_of_oz (Hermit) on Apr 19, 2005 at 19:20 UTC | |
Re: Behind the Scenes - Perl Variables
by Anonymous Monk on Aug 27, 2008 at 17:15 UTC |