Re: Declaring final variables




vincente13@xxxxxxxxx wrote:
it seems like i dont have the module Readonly....any other workaround?

by the way im trying to create a static variable also..
i've read the manpage on creating a static variable..but i still dont
quite get it..

For e.g.
my $var;
my $string = "This is ".$var." my path";
$var="overwrite";
print $string;

if $var is static, then $string should print out "This is overwrite my
path"

This has nothing whatsoever to do with static variables.


How do i achieve this?

You want a subroutine (i.e. in java speak a "static method"):

sub qstring($) {
my $var = shift;
return "This is $var my path.";
}

my $string = qstring "overwrite";
print $string;



Appreciate any help.

.



Relevant Pages

  • Re: Declaring final variables
    ... it seems like i dont have the module Readonly....any other workaround? ... i've read the manpage on creating a static variable..but i still dont ... if $var is static, then $string should print out "This is overwrite my ...
    (comp.lang.perl.misc)
  • Re: Calculate the string statement
    ... verkn:(vkn:char; ... funkt:(fkt:string; ... var fkt,dfkt: p; ... var fehler: boolean; ...
    (comp.lang.pascal.borland)
  • Two new tests for MM B&V
    ... var RunningThreads: Integer; ... class function TStringThreadTest.GetBenchmarkDescription: string; ... function CheckPattern(const Dest: Pointer; const Size: Integer; const ...
    (borland.public.delphi.language.basm)
  • server-side JavaScript: Prototypes of built-in classes, objects and functins
    ... Session object (disk-based session variables for data persistence ... File class (manipulation of files on server, ie. open, close, read, ... //Methods Cgi.queryCgi.postCgi.anyby default return an empty string if requested var not found ...
    (comp.lang.javascript)
  • Re: [PHP] Image Generation
    ... the text, font, colour, maximum frame size (ie the width and height it ... var $xoffset, $yoffset, $margin; ... a string or array of strings. ... a float or an array of floats - which size to display the related text at. ...
    (php.general)