SPUG: Windows Newbie Needs Help

Andy Jacobs andyj at microsoft.com
Wed Sep 27 15:03:53 CDT 2000


When you type Perl from a command line, the normal thing to specify next is
a file with your Perl script in it.  If you create a file (using NOTEPAD, or
any other text editor) and put your line of code:
	print "This is a string!";
in it (e.g., call it SAMPLE.PL).  You then run your code by typing
	Perl SAMPLE.PL
on the DOS command line.

If you want to run the script without creating a file, you need the "-e"
option.  But in DOS, things are a bit more tricky than in Unix, and DOS does
not nicely handle the embedded quotes in your script (and doesn't recognize
single-quotes for command line parameters).  So, you could write:
	Perl -e "print 'This is a string!';"
or, if you need to use double-quoted strings in the script itself, you can
use Perl's ability to change the quote character like this:
	Perl -e "print qq{This is a string!};"
(where qq{...} is the same as "..." in Perl).

You can also take advantage of Perl's ability to read from standard input
when no script is specified (which works on DOS, Unix and probably most
other platforms).  Your transcript would look like this:
	Perl
	print "This is a string!";
	^Z
(note: type the "Perl" at the command prompt, press enter, then type the
next line, press enter, and then ^Z is Ctrl-Z, or F6 on most DOS/Windows
machines, and enter again).

Hope this helps.

 - Andy Jacobs

-----Original Message-----
From: owner-spug-list at pm.org [mailto:owner-spug-list at pm.org]On Behalf Of Tim
Maher/CONSULTIX
Sent: Wednesday, September 27, 2000 11:32 AM
To: spug-list at pm.org
Subject: SPUG: Windows Newbie Needs Help

Hello SPUG,
my name is Bogdan Vladu and I am currently trying to educate myself in Perl.
I am using "Perl for Dummies 2nd edition" by Paul Hoffman.
Although the book makes sense (so far ...) I am unable to put in practice
what I am reading (learning ?!).
I am a totally neophite to the programming field and my only experience with
programming was in college, struggling to write and understand "Fortran".
Anyway, I installed Perl version 5.005 on Windows '95 but have no clue how
to proceed to run loaded programs (from the accompanying CD-Rom) or basic
commands such as "print".
For example, while typing (this is the actual line on the ms-dos prompt)
the reply appears.

C:\Perl>perl print "This is a string!" ;
Can't open perl script "print": No such file or directory

I am aware that I might be stupid but I know that I installed the CD-Rom
correctly and it seems that numerous files and short programs have been
installed on the hard drive.

If you guys have can help me with this matter or at least with suggestions
for a better book that will help me learn Pearl  I'm all ears.

Thank you !

Bogdan Vladu
bvladu at hotmail.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list