in reply to Printing values from references
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;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Printing values from references
by fuzzyping (Chaplain) on Sep 13, 2003 at 23:57 UTC | |
by Fletch (Bishop) on Sep 14, 2003 at 00:31 UTC | |
by fuzzyping (Chaplain) on Sep 14, 2003 at 00:36 UTC | |
by gryphon (Abbot) on Sep 14, 2003 at 05:01 UTC |
In Section
Seekers of Perl Wisdom