Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Can't understand one line

by 7stud (Deacon)
on Jan 07, 2013 at 09:43 UTC ( #1011998=note: print w/replies, xml ) Need Help??

in reply to Can't understand one line

use strict; use warnings; use 5.012; package Person; sub new { my $class = shift; my $self = {}; bless $self, $class; return $self; } sub do_this { my($self, $greetee) = @_; say "hello $greetee"; } sub do_that { my($self, $greetee) = @_; say "goodbye $greetee"; } 1;
use strict; use warnings; use 5.012; use Person; my $obj = Person->new; $obj->do_this("Sam"); $obj->do_that("Cathy"); say '*' x 20; my @func_names = ('do_this', 'do_that'); my @names = ("Sam", "Cathy"); call_funcs(@names); sub call_funcs { for (@func_names) { $obj->$_(shift @_); } } --output:-- hello Sam goodbye Cathy ******************** hello Sam goodbye Cathy

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011998]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2016-12-02 21:14 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (50 votes). Check out past polls.