I think it would be good to learn OOPerl. Any tips, ideas, or suggestions on starting?
Aug 22, 2002, 8:49 AM
Veteran (19537 posts)
Aug 22, 2002, 8:49 AM
Post #2 of 13
Views: 8762
I'm available for consulting at $100/hr. Please email me.
Heh, joking.
http://www.perldoc.com/...ee/AboutObjects.html
...and...
http://www.manning.com/Conway/
Heh, joking.
http://www.perldoc.com/...ee/AboutObjects.html
...and...
http://www.manning.com/Conway/
Aug 22, 2002, 9:46 AM
Administrator (9387 posts)
Aug 22, 2002, 9:46 AM
Post #4 of 13
Views: 8813
Here's a few more:
http://perldoc.com/....0/pod/perlboot.html
http://perldoc.com/....0/pod/perltoot.html
http://perldoc.com/....0/pod/perltooc.html
http://perldoc.com/...8.0/pod/perlbot.html
(in order of complexity).
Cheers,
Alex
--
Gossamer Threads Inc.
http://perldoc.com/....0/pod/perlboot.html
http://perldoc.com/....0/pod/perltoot.html
http://perldoc.com/....0/pod/perltooc.html
http://perldoc.com/...8.0/pod/perlbot.html
(in order of complexity).
Cheers,
Alex
--
Gossamer Threads Inc.
Aug 22, 2002, 2:16 PM
User (189 posts)
Aug 22, 2002, 2:16 PM
Post #5 of 13
Views: 8765
Thanks Alex. I am working my way through those slowly, and am currently in the middle of the big references page. I find it quite hard, but I'm sure that I can do it and when I do it will be rewarding in that I will have command of something as powerful as a proper OOP language. Then finally, I might be able to understand how Links SQL works.
Aug 23, 2002, 6:34 AM
Novice (48 posts)
Aug 23, 2002, 6:34 AM
Post #6 of 13
Views: 8737
This is really a nice book and covers all you have to learn
http://btobsearch.barnesandnoble.com/...&isbn=1884777791
http://btobsearch.barnesandnoble.com/...&isbn=1884777791
Aug 23, 2002, 7:14 AM
Veteran (19537 posts)
Aug 23, 2002, 7:14 AM
Post #8 of 13
Views: 8766
>>
Can someone explain why this makes a new hash and returns a reference to it:
sub hashem { +{ @_ } }
<<
A hash is just an associative array, ie the following will work as a hash but may look like an array to you:
my %hash = ( a, 1, b, 1, c ,1 );
$hash{a} prints 1 as does $hash{b} and $hash{c};
The { } references @_ which is essentially the same as
%hash = \%hash;
The + sign forces an anonymous hash contructor.
Can someone explain why this makes a new hash and returns a reference to it:
sub hashem { +{ @_ } }
<<
A hash is just an associative array, ie the following will work as a hash but may look like an array to you:
my %hash = ( a, 1, b, 1, c ,1 );
$hash{a} prints 1 as does $hash{b} and $hash{c};
The { } references @_ which is essentially the same as
%hash = \%hash;
The + sign forces an anonymous hash contructor.
Aug 23, 2002, 7:21 AM
Veteran (19537 posts)
Aug 23, 2002, 7:21 AM
Post #10 of 13
Views: 8729
I edited my post above, I wasn't thinking. + is needed to create the anonymous hash.
print "Content-type: text/html\n\n";
print $hashref->(1..6)->{5};
Thats a basic example. A list of 1 2 3 4 5 6 is passed to my anonymous sub and a hashref is returned...therefore really it looks like:
1 => 2, 3 => 4, 5 => 6
....so that code above will print 6
Code:
my $hashref = sub { +{ @_ } }; print "Content-type: text/html\n\n";
print $hashref->(1..6)->{5};
Thats a basic example. A list of 1 2 3 4 5 6 is passed to my anonymous sub and a hashref is returned...therefore really it looks like:
1 => 2, 3 => 4, 5 => 6
....so that code above will print 6
Aug 23, 2002, 7:23 AM
User (189 posts)
Aug 23, 2002, 7:23 AM
Post #11 of 13
Views: 8712
Sorry, I did actually type a question underneath the quote but Gforum deleted it, as it does. You have now answered my question. I'll try and look at this more as I still don't understand how the + creates the anon hash.
I deleted the post above as my reply didn't make it and it is now obselete.
I deleted the post above as my reply didn't make it and it is now obselete.
Aug 23, 2002, 7:26 AM
Veteran (19537 posts)
Aug 23, 2002, 7:26 AM
Post #12 of 13
Views: 8722
You don't need to worry about how it creates it, it just does :)
It is to do with perl reading ahead and blocks/expressions.
The map perldocs may help a little bit more:
http://www.perldoc.com/....1/pod/func/map.html
Scroll down to near the bottom.
It is to do with perl reading ahead and blocks/expressions.
The map perldocs may help a little bit more:
http://www.perldoc.com/....1/pod/func/map.html
Scroll down to near the bottom.