in reply to Re^2: Linux Mint
in thread Linux Mint

My thing is, being able to use the program in the console to begin with. What command would I use to start editing and typing in my program? I started programming with VSBASIC 1982. Not much since.

Replies are listed 'Best First'.
Re^4: Linux Mint
by stevieb (Canon) on Sep 01, 2016 at 19:04 UTC

    I use vim or vi. There's a learning curve to it though. pico is a very easy-to-use editor if you've never used a command-line editor before.

    After you've opened up an empty file: vi script.pl or pico script.pl, write some code:

    use warnings; use strict; my $tired = 0; if ($tired){ print "goodbye, world!\n"; } else { print "hello, world!\n"; }

    Now, save the file, exit the editor and run the script directly from the command line:

    perl script.pl

      pico is a bit dated now - I think most distro's have nano installed (Not ANOther editor) which is an enhanced clone of pico. I use it all the time and have done for about 12 years.

      Nick

Re^4: Linux Mint
by Marshall (Canon) on Sep 02, 2016 at 21:04 UTC
    Oh, I think I see the conceptual problem. Some languages like BASIC and Python provide two environments. One where you type a line of code in and then that line of code runs immediately and the result is displayed right away. The other environment is where you type in the program using a text editor and then run the complete program all at once. That is the way that your Perl developmemt will work.

    I do most of my work on Windows, so I am not the best for advice on Unix. However, I know from when I used to have a Sun workstation, that something similar to what I do on Windows is possible on Unix. I'll describe what I do so you can see what the goal is.

    I use Textpad as my program editor for Perl development on Windows. I think Notepad++ has similar features. I have a single "Perl go button" that saves all open files, runs the Perl program in the active editor window and captures STDOUT and STDERR to another editor screen. I've written a lot of code with this simple arrangement.

    Many editors, mine included have fancy features that do syntax highlighting, etc. I turned all that stuff off because I find it annoying. However since the editor is designed to write software, it knows about indenting and that is very useful. If the current line has an indent of say, 4, a carriage return brings the cursor back to that same indent level on the next line.

    There are things called "Integrated Development Environments" or IDE. I don't use one for Perl, but I do for Java. That's because Java is so verbose that I need a program to help me spew out all of the required boilerplate! Perl is very much more "to the point".

    Anyway, I suggest one goal for a simple environment is to make the cycle: "edit, run program, look at output" very easy and fast. You can go a long ways with that. I can't remember the last time I used the Perl Debugger. It is so easy for me to add a "print" statement using Data::Dumper that I just don't need it often. I just hit one "F key" and poof! I am looking at the program's output.