Basic Perl Help needed.

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Basic Perl Help needed.

Post by bat2004 on Thu Oct 30, 2008 3:19 pm
([msg=14285]see Basic Perl Help needed.[/msg])

Hi there.

I have just started learning perl on a windows machine(like it or not) and when i run my perl files the command window keeps closing before i can read the output. I guessed it would be a simple command such as "Pause;", however after a good search on the internet i could not find any pause or simaler commands.

I am using ActivePerl, if thats any help to answer my question.
bat2004
New User
New User
 
Posts: 2
Joined: Wed Jun 04, 2008 8:09 am
Blog: View Blog (0)


Re: Basic Perl Help needed.

Post by eljonto on Fri Oct 31, 2008 3:45 pm
([msg=14337]see Re: Basic Perl Help needed.[/msg])

Three solutions i can think of:
1) run the program from the command line
2) put $varname=<STDIN>; at the end of the program (so it waits for userinput)
3) put system("pause"); at the end of the program

simple as that ;)
-Quis custodiet ipsos custodes?, Juvenal
_________________________________________________________________
User avatar
eljonto
Poster
Poster
 
Posts: 373
Joined: Thu Apr 17, 2008 1:16 am
Location: Australia
Blog: View Blog (0)


Re: Basic Perl Help needed.

Post by Liquid_Obsidian on Mon Nov 17, 2008 3:19 am
([msg=15119]see Re: Basic Perl Help needed.[/msg])

Happens cause you click on the script instead of launching it from the so called "cmd"

win_menu -> execute -> "cmd"

exemple of running (at least works with activeperl)
cd \to\the\plscript\folder
toto.pl
"hello world..."

et voila...
Liquid_Obsidian
New User
New User
 
Posts: 8
Joined: Sun Oct 12, 2008 12:50 pm
Blog: View Blog (0)


Re: Basic Perl Help needed.

Post by eljonto on Sat Nov 22, 2008 7:50 pm
([msg=15329]see Re: Basic Perl Help needed.[/msg])

lol it prints hello world anyway, just closes to fast for you to see it
-Quis custodiet ipsos custodes?, Juvenal
_________________________________________________________________
User avatar
eljonto
Poster
Poster
 
Posts: 373
Joined: Thu Apr 17, 2008 1:16 am
Location: Australia
Blog: View Blog (0)



Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests