Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Complete novice in need of guidance

by SerpSomal (Novice)
on Oct 02, 2016 at 20:07 UTC ( [id://1173124]=perlquestion: print w/replies, xml ) Need Help??

SerpSomal has asked for the wisdom of the Perl Monks concerning the following question:

Hello. I have never coded before so please be gentle.

Today I decided to try and give coding a go, so I went tot he bookstore and (probably naively) picked up a copy of the book 'Learning Perl'. In order to complete some of the exercises which the book sets I need to code in Perl. I am a complete novice and had no idea how to go about doing this. I have watched a few Youtube videos and scoured some websites and this is what I have done so far:

Dowloaded and installed Xcode

Downloaded and installed Atom as a text editor

Downloaded and installed PerlBrew

After installing PerlBrew using the  \curl -L https://install.perlbrew.pl | bash in Terminal app I was notified that I need to make an amendment to my bash profile. However I cannot seem to find this file.

I am completely lost here, not only around finding this bash profile but also about understanding what a compiler/text editor/perlbrew all are and how they work together

I would really appreciate it if anyone has the time to explain to me what the heck I am actually doing and whether I am going about it in the correct way

Thanks

Replies are listed 'Best First'.
Re: Complete novice in need of guidance
by stevieb (Canon) on Oct 02, 2016 at 22:45 UTC
    "understanding what a compiler/text editor/perlbrew all are and how they work together"

    Compiler:

    A piece of software that takes the code of a high(er) level programming language, and transforms it through various means to machine code (ie. typically assembly (see machine code)), which the CPU understands.

    Text Editor:

    A piece of software that allows you to type text into. Common ones for Unix(y) platforms include vi/vim, emacs (both of those stated have a significant learning curve to them), nano, an easy one to use. There are also a slew of them for the Unix user interface. On Windows, a text editor would be notepad.exe. Some consider Microsoft Word a text editor, but I don't; it adds a whole slew of things into your document without you realizing it, so it doesn't turn out to be text-only. Don't use this (or Wordpad) for writing Perl (or code in any language). Notepad++ is probably one I'd pick to use on Windows if vim wasn't available.

    perlbrew:

    A piece of software App::perlbrew (berrybrew for Windows) that allows you to install and manage several versions of the Perl programming language on your system, without interfering with a system-installed perl, if available.

    It allows you to do things on specific instances of Perl, and if needed, blow away the instance and re-install it with no side effects. Although there are many features I'm not explaining, it allows you to install versions of Perl in your own user home directory, so it doesn't affect anything other users may decide to do.

    Summary:

    You write your code in a text editor (eg: script.pl has all of your Perl code), and then have perl execute it (eg: perl script.pl). Perl (or rather perl (the lower-case form is the name of the interpreter itself)), then interprets the code in the script file you wrote with the text editor, and then *compiles* it into machine-ready code behind the scenes. It then passes it off to the CPU, which processes your instructions.

      Thanks for taking the time to explain these terms. I found it really helpful

      perlbrew: ... berybrew ...

      :)

      To all beginners, you don't need these extras, they're just extras to save a few keyboard strikes ... for a very very small amount of perl developers ( less than %1 )

        "To all beginners, you don't need these extras, they're just extras to save a few keyboard strikes ... for a very very small amount of perl developers ( less than %1 )"

        I'd like to know where you got your 1% statistic from :) I believe they do far, far more than just save a few "keyboard strikes"... they help prevent you from hosing your system's Perl, and in some cases, your system itself.

        I know more people who use perlbrew than I know that don't...

Re: Complete novice in need of guidance
by GrandFather (Saint) on Oct 02, 2016 at 21:49 UTC

    If you are using a Mac (implied by Xcode) open terminal window and type:

    perl -v

    That should get you something that looks a little like:

    This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x +86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2012, Larry Wall Binary build 1603 [296746] provided by ActiveState http://www.ActiveSt +ate.com Built Mar 13 2013 11:29:21 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.

    The details will be different because I'm using a Windows machine so my Perl was build for Windows, but that doesn't matter much. If that worked, cd to somewhere you can create files (your home directory ~ would be a reasonable place) and type: nano hello.pl then press return. In the nano editor enter:

    #!/usr/bin/perl use strict; use warnings; print "Hello World\n";

    Press Ctrl-X then Y and return to exit and save your changes to the file hello.pl. Type perl hello.pl then return. You have now written and run your first Perl program. For extra points you can chmod ug+x hello.pl to make the script executable without needing to use the Perl interpreter directly. You can then just ./hello.pl.

    You should now be in a position to run examples and do exercises from the book.

    Premature optimization is the root of all job security
Re: Complete novice in need of guidance
by Laurent_R (Canon) on Oct 02, 2016 at 22:38 UTC
    Today I decided to try and give coding a go, so I went tot he bookstore and (probably naively) picked up a copy of the book 'Learning Perl'.
    Perhaps naive, but a very good pick. Learning Perl is an excellent book.

    If you feel overwhelmed, you probably don't really need Xcode, Atom and PerlBrew to get started.

    If you get a sensible result from perl -v and can use any text editor (but not a word processor), then you can start. Write your script with the editor and run it under the bash prompt with a command such as:

    perl my_script.pl
    You can finalize your set-up later.

      ++ for Learning Perl book.

      To the OP:

      There's also a slew of information out on the web, but one needs to take using it solely with a fistful of salt as many aren't as good or as updated as others. One really good beginner website is Learn Perl.

      When in doubt on which online resources to use or books to buy/borrow/beg/steal, you could always ask here in the Chatterbox, or another question in Seekers of Perl Wisdom, as you've done here already.

      Learning Perl is fantastic IMHO for beginners. I will also suggest beginners to read modern perl as a compact reference for modern perl 5 with details.

Re: Complete novice in need of guidance
by dagufri (Acolyte) on Oct 03, 2016 at 11:07 UTC
    Hi SerpSomal,

    As a general tip, I thought this site was awesome when getting started with Perl. It covers a lot of the basics with examples.

    http://perlmaven.com/perl-tutorial

Re: Complete novice in need of guidance
by mfzz (Novice) on Oct 05, 2016 at 13:37 UTC
Re: Complete novice in need of guidance
by Anonymous Monk on Oct 03, 2016 at 15:30 UTC
    As has been said a text file editor is essential.
    I have found that Jens file editor is very god and can be found at
    http://wareseeker.com/Software-Development/jfe-jens-file-editor-3.90.zip/319010
    and elsewhere.
    This site has a good description of how to use it
    http://home.arcor.de/jensaltmann/jfe/jfe_eng.htm

      Please, when posting URLs of file downloads, provide a canonical URL that is supported by the authors website, not some random software download link. The author seems to use http://home.arcor.de/jensaltmann/jfe/jfe_e.zip as their canonical download URL.

      Also, you might want to mention that this is a Windows-only program and seemingly not available for other OSes.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1173124]
Approved by choroba
Front-paged by stevieb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-20 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found