develooper Front page | perl.beginners | Postings from April 2002

RE: Brand New Perl Beginner - trouble using activePerl

From:
David Gray
Date:
April 30, 2002 13:22
Subject:
RE: Brand New Perl Beginner - trouble using activePerl
Message ID:
001101c1f084$921c92e0$7800a8c0@3b2.com
> I am learning perl now for use with CGI.
> 
> I installed active Perl on both windows Millenium AND windows 
> XP systems.
> 
> Both of the fail to run a .pl file.  I see a window flash on 
> the screen for a part of a second and then disappear.....the 
> window looks like it is a DOS command window.
> 
> Anyway, I do not see the program run.  Of course I am doing 
> something very basic wrong....anyone know what it is???  Thanks !!!

If you want your program to pause during execution if, for example, you
have a lot of output you could insert statements like this:

{ my $trash = <STDIN>; }

What this does is waits for you to hit enter and takes whatever you
typed (if anything) and puts it into the variable $trash, which then
goes out of scope because the block it's in ends.

Sometimes when I want to quit out of a loop, I'll do:

{ my $trash = <STDIN>;
  last if $trash =~ /q/;
  exit if $trash =~ /x/; }

But the more simple example will probably work for what you want.

Hope that helps,

 -dave





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About