SCIENTIFIC-LINUX-USERS Archives

November 2015

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Paul Robert Marino <[log in to unmask]>
Reply To:
Date:
Mon, 23 Nov 2015 22:31:06 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (33 lines)
That's one example of anonymous references called an anonymous code reference, which is vital to understanding how Perl 5 object oriented syntax works but it goes much deeper than that. Also there is a syntax similar to the C++ example that works in Perl too, wherever you see that "my $var=modulename->new();" syntax in the documentation.
I'm still out with friends but will be home soon. I'll send out a more complete reading list (which I've used to train Jr. Perl programmer before) then. Along with some links to well documented code example I've written over the years on github and source forge which  you can ask me questions about if there is any thing you don't understand.

  Original Message  
From: Konstantin Olchanski
Sent: Monday, November 23, 2015 19:51
To: ToddAndMargo
Cc: [log in to unmask]; [log in to unmask]
Subject: Re: Perl window question

On Mon, Nov 23, 2015 at 02:58:35PM -0800, ToddAndMargo wrote:
> 
> "anonymous references"? Is that the mysterious "->" thingy?
> 
> $ua = LWP::UserAgent->new;
> $ua->timeout ( MaxTime1 );
> $ua->show_progress;
> 

perl-for-dummies to the rescue, read section about object-oriented programming in perl.

Quick answer, it is same as C++:

std::string *s = new std::string;
s->length();
s->c_str();

-- 
Konstantin Olchanski
Data Acquisition Systems: The Bytes Must Flow!
Email: olchansk-at-triumf-dot-ca
Snail mail: 4004 Wesbrook Mall, TRIUMF, Vancouver, B.C., V6T 2A3, Canada

ATOM RSS1 RSS2