perl.j has asked for the wisdom of the Perl Monks concerning the following question:
I am totally new to Perl. This is my first programming language. Is there anything I should know besides the basics? I think I got those down.
Re: Perl: For Newbies
by davido (Cardinal) on Jul 01, 2011 at 22:17 UTC
|
If Perl is your first programming language, you should probably start with Learning Perl, published by O'Reilly & Associates. Frankly, I would probably suggest following that up with a book specifically on Computer Science. I wish I could recommend one, but I was in your shoes back in about 1981, and my 'upbringing' included high-school Computer Science classes (Apple II Basic, and then Pascal), Byte magazine, 1980's programming books, and later on, college Computer Science classes. So I really don't know what book to recommend anymore for Comp Sci. Knuth is going to be too deep for most mortals just starting out (and mostly even for professionals). ;)
I do believe that after learning the basics of a specific language, learning the basic fundamentals of computer science is more important as a 'next step' than learning more advanced syntactical rules and tricks in said language.
Once you get a bit of of the foundation laid in Computer Science, you can go back to the Perl books, such as Intermediate Perl (O'Reilly), as well as Mastering Algorithms with Perl (O'Reilly). That last book is pretty old (1999), but good algorithms don't change as quickly as languages themselves, so I feel it is still a valuable book to work through.
One should never overlook the value of the Perl POD. perlintro, perlsyn, perlsub, perlreftut, perlretut, and so on. It's free, and it's great.
After that, decide what it is that interests you and dig in! My home node contains a list of books that I have found useful over the years. Most of them are not read-once types of books. After an initial reading, I find them to be helpful when I need to dive back into a topic after some time has passed as well.
Oh, and in case nobody else mentions it to you: Congratulations on asking a fantastic question. Welcome back to the Monastery any time.
| [reply] |
|
Thank You Sooooo Much! This was a great help!
| [reply] |
|
Sorry, but my nearly-complete collection of Byte is not for sale. :-D
Yup, looking back, Professor Carl Helmers’ class was the very best one of all, and where I probably got most of my practical education. It arrived in my mailbox every month and systematically got read to pieces during the next thirty-odd days.
| |
Re: Perl: For Newbies
by GrandFather (Saint) on Jul 01, 2011 at 22:38 UTC
|
| [reply] |
Re: Perl: For Newbies
by luis.roca (Deacon) on Jul 02, 2011 at 03:27 UTC
|
"I am totally new to Perl.
This is my first programming language. Is there anything I should know besides the basics? I think I got those down."
Welcome to Perl Monks!
Perl is also my first programming language and after over a year and
a half, I'm glad I made that choice. I was very fortunate to join the
Monastery the day I decided to begin learning Perl. I spent the first
several months going through many of the posts and tutorials. You'll
enjoy your time here, get a lot out of it and meet some really great teachers — you've just met three in davido, Grandfather and (most of the time) Anonymous_Monk. :-)
From one beginner to another here are a few suggestions on where to go from the basics:
- Elements of Programming with Perl covers
much of what is in Learning Perl and Intermediate Perl but differently.
It's definitely geared towards students like you and I who have no prior
programming experience and are beginning our education with Perl. It
teaches you how to think about your problems while going through the
Perl language. Each chapter covers a different topic and ends with a
problem that the author breaks down in 'pseudo code' before
translating it to Perl. The problems are 'real world', fun to do and
expanded upon with questions at the end.
- Perl Cookbook is a great book to grow with especially if you learn best
by example. Each chapter covers a different topic in relatively
bite sized chunks progressing from beginner to more advanced levels. For
now you can just stick to the first example or two in each chapter
moving on to more difficult ones as your skills and knowledge grow.
- For fun: Gödel, Escher, Bach is a
classic book that discusses a lot of common computer programming
theories and shows how they are represented in music, art, math —
basically all of life.
As you are no doubt noticing there are A LOT of good Perl books and
it can get overwhelming quickly. I would caution (slightly at least) against what I did
in my first year of learning Perl and suggest focusing on no more than
three books. ;-)
Best of luck and I hope to see more of you in the coming weeks and months.
Luis
"...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." — Don Quixote
| [reply] |
|
You guys are a great help. Thank You for all of the information, books, etc.
I am trying to absorb as much as possible so this was exactly what I needed
Thanks Again
| [reply] |
Re: Perl: For Newbies
by Anonymous Monk on Jul 02, 2011 at 01:44 UTC
|
| [reply] |
Re: Perl: For Beginners
by sundialsvc4 (Abbot) on Jul 02, 2011 at 19:21 UTC
|
One of the most peculiar and yet most important things to consider about “learning programming” is not the obstacle which presents itself to you from the very first moment of unfamiliarity, namely: “where do all the punctuation marks go, and how do I make the damn thing compile?” (Believe it or not, it merely takes practice.) (And beer.)
The true challenge to the beginning student is understanding how the capabilities of the computer, and of this-or-that programming language (oddly, it doesn’t matter so much “which one”), are applied to the solution of a particular problem. This is why a programmer who might appear to be doing nothing at all, or who might have a penchant for taking long walks as I do, might actually be doing the very hardest work of the entire day. Here is a machine, which can only do a very few things but which can do those very few things unbelievably fast, and we want to make it do ... this ... or that. Given that there are no cut-and-dry answers, only a handful of well-worn paths ... how do you not only do it, but do it well? How, indeed. (And then one day you start poking around the other neighborhoods, where you stumble upon things like Prolog, or “R,” or Common Lisp, and you realize that there is no ending to this happy obsession of yours. It’s like really good science-fiction, but in real life.)
At the start, you are going to spend a lot of time wrestling with punctuation and syntax. You are also going to have to deal with frustration ... as you will, mark my words, continue to have to do forevermore. (It is the nature of the beast.) But if you are at all like me, you will continue to find it endlessly challenging and (sometimes) rewarding. I consider myself very fortunate to have turned what was the fascination of a six-year old kid, fully a decade and a half before the first practical “personal” computer existed, into a career that I still enjoy doing ... never-you-mind how-many years later.
Welcome to the craft. Please feel welcome, and welcomed, here.
| |
|
This was great advice. Truthfully I wanted to start doing this before I was a teenager (I don't like to disclose my exact age either LOL) but was always intimidated by all of the code.
As I started actually jumping into Perl I realized this wasn't just easy (somewhat...I guess) but pretty fun. I am trying to absorb as much info as I can. I know I'm not gonna be the next Bill Gates or Steve Jobs (Or maybe I will...) but my goal is that by the end of my life I would like to come close to it.
Thank You for the advice and thank EVERYONE THAT POSTED ANYTHING HERE for all of the great help!
| [reply] |
Re: Perl: For Beginners
by Steve_BZ (Chaplain) on Jul 16, 2011 at 12:58 UTC
|
Hi pj,
I use Perl by Example. It doesn't have such a great write-up, but I found it very helpful with exercises and examples.
You imply in another post that you use perl/tk. I'm sure it's very fine. You might want to try wxPerl. It is object orientated and implemented in C++, Perl, Python, Ruby and on many platforms including Windows, Linux and Mac - sadly no iPad or Android yet, although I hope that will come. Also no real support for gesture programing, kinetic scroll or other touch-screen developments.
Good luck.
Regards
Steve
| [reply] |
|
| [reply] |
|
| [reply] |
|
How did you learn wxPerl? I really can't find a good book/tutorial anywhere.
Then you're not really looking :)
Tutorials: How to RTFM
Wx says This module comes with extensive documentation in HTML format; you can download it from http://wxperl.sourceforge.net/
- http://wxperl.sourceforge.net/
- http://wxperl.sourceforge.net/manual/manual.html
- http://wxperl.sourceforge.net/tutorial/tutorial.html
- wxPerl: Another GUI for Perl
- http://wiki.wxperl.info/
- WxPerlTablet, a kind of WxPerl cheat sheet
- GUI development with wxGlade by Johan Vromans
- wxGlade: a GUI builder for wxWidgets/wxPython
- VisualWX Rad with Form Designer (wxWidgets)
- wxGlade Tutorial
- OrganizingYourCode - wxPyWiki
- wxGlade user manual
- http://docs.wxwidgets.org/2.8.4/wx_contents.html
- Topic overviews
- Writing a wxWidgets application: a rough guide
- Laying out window elements with sizers
- Event handling overview
- Events and Event Handling
- Microsoft HTML Help (CHM) format
- ZIP file containing HTML documentation
- PPM binary packages built by Mark Dootson can be downloaded from the wxPerl Binary Oasis
- [irc://irc.perl.org/#wxperl] or #wxperl channel using Mibbit
- Tutorials: User Interfaces: wxPerl Tutorials
- wxPerl Tutorial one :: The basics by boo_radley
- wxPerl image handling (short & sweet). by boo_radley
- wxPerl tutorial 3 -- by boo_radley
- Wx ControlTutorial : Wx::ProgressDialog by boo_radley
- Wx::Demo/wxperl_demo
- wxperl_demo --show wxTreeListCtrl
- Wx::App::Mastermind a nontrivial example of wxPerl threads
- ?node_id=3989;HIT=Wx;re=N
- Is wxPropertyGrid available under WxPerl?
- Re: problem with wxTextCtrl right alignment
#!/usr/bin/perl --
use strict;
use warnings;
use Wx;
use Wx::Demo;
my $app = Wx::SimpleApp->new;
my $demo = Wx::Demo->new;
$demo->show_module( 'Wx::DemoModules::wxRichTextCtrl');
$demo->show_demo_window;
$app->MainLoop;
exit( 0 );
- RFC for Tutorials: Using BoxSizer Layout Manager in wxPerl
- Re^5: Packaging Perl Programs (is) Painful
and GTK2::GladeXML both fell into the category of unbuildable last time I tried on Win32
Yes, its a huge negative that there aren't ppms for the various Gtk2..., but there is hope, See Re: install Gtk2::GladeXML
I think Wx looks great and has the functionality I'd need, but all of the existing documentation is for the C++ version. You need to translate it to perl, and not all concepts map cleanly from one language to the other. And as the original poster pointed out, it's not trivial to deploy a WxPerl application.
They map well enough , honest. Start with http://wxperl.sourceforge.net/tutorial/tutorial1.html
Then download chm file here,
Wx-Demo, and dont forget about the samples
Short version, wxFrame in perl is Wx::Frame, methods are called using arrow not dot.
For all other differences the documentaion contains notes like this
wxWindow::ClientToScreen
virtual void ClientToScreen(int* x, int* y) const
wxPerl note: In wxPerl this method returns a 2-element list instead of
modifying its parameters.
virtual wxPoint ClientToScreen(const wxPoint& pt) const
Converts to screen coordinates from coordinates relative to this window.
x
A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
a screen coordinate will be passed out.
y
A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
a screen coordinate will be passed out.
pt
The client position for the second form of the function.
wxPython note: In place of a single overloaded method name, wxPython
implements the following methods:
ClientToScreen(point)
|
Accepts and returns a wxPoint
|
ClientToScreenXY(x, y)
|
Returns a 2-tuple, (x, y)
|
so in wxperl this maps pretty much the same.
So you can use any of these
$ perl -MWx -le"print for Wx::Window->new->ClientToScreen( 0,0 )"
0
0
$ perl -MWx -le"print for Wx::Window->new->ClientToScreen( [0,0] )"
Wx::Point=SCALAR(0x98a3c4)
$ perl -MWx -le"print for Wx::Window->new->ClientToScreen( Wx::Point->
+new( 0,0 ) )"
Wx::Point=SCALAR(0xda76e4)
In perl [ -1, -1 ] is a shortcut for
wxPoint or wxSize depending on context.
Heres a hint to how wxPerl does overloading
$ perl -MWx -le"print for grep /clienttoscreen/i, keys %Wx::Window::"
ClientToScreenPoint
ClientToScreen
ClientToScreenXY
So you could also write
$ perl -MWx -le"print for Wx::Window->new->ClientToScreenXY( 0,0 )"
0
0
$ perl -MWx -le"print for Wx::Window->new->ClientToScreenPoint( [0,0]
+ )"
Wx::Point=SCALAR(0x3e8b64)
$ perl -MWx -le"print for Wx::Window->new->ClientToScreenPoint( Wx::Po
+int->new( 0,0 ) )"
Wx::Point=SCALAR(0x9cf5c4)
- ...
| [reply] [d/l] [select] |
|
|
| [reply] |
|
|