Greetings fuzzyping,
Pardon the rough nature of this code, but take a look at this:
#!/usr/bin/perl use strict; use warnings; package Thing; sub stuff { return 'word'; } sub new { return bless {}, shift; } package main; my $thing = new Thing; print $thing->stuff, "\n"; print "$thing->stuff\n"; print $thing, "\n";
When you put $thing->stuff into quotes, Perl interprets only the $thing instead of the whole line. One solution is to do exactly what you've done which is to not put the $thing->stuff inside quotes. I remember seeing a way to get Perl to interpret the whole $thing->stuff inside a double-quote, but I never use it, so I can't remember the exact syntax right now.
gryphon
code('Perl') || die;
In reply to Re: Printing values from references
by gryphon
in thread Printing values from references
by fuzzyping
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |