Thanks for the link, that will definitely help.
I am now having the same trouble as I did before...
#!/usr/bin/perl
$str = 12;
$rec = {
name => "Anonymous",
age => 25,
strmod => statmod($str),
};
print $rec->{name}."\n";
print $rec->{strmod}."\n";##comes out to 1
$str = 14;
print...
Wow, I feel stupid. I tried using:
$total = sub{$var + $var2}
But was having trouble printing and referencing $total elsewhere in the program, and just realized I was making syntax errors.
This is for a D&D style RPG I've been writing in my spare time. I have a large list of variables (around...
I suppose I could take that approach...
Do you know if there is any way I could do this with dereferencing? The following works:
$number = 2;
$something = /$number;
print $$something;
$number = 3;
print $$something
I can't seem to get it to work when $something is equal to two variables added.
I'm very new to perl, and I'm having trouble with the following script:
#!perl
$firstnum = 3;
$secondnum = 2;
$total = $firstnum + $secondnum;
print $total; ##comes out to 5
$firstnum = 6;
print $total; ##comes out to 5 (I know why) - but I want to come out to 8
How do I write this so...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.