delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/02/05:32:35

Date: Fri, 02 Mar 2001 12:32:11 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: sokal AT holyrood DOT ed DOT ac DOT uk
Message-Id: <8011-Fri02Mar2001123210+0200-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
CC: djgpp AT delorie DOT com
In-reply-to: <Pine.SOL.4.21.0103012025260.2223-100000@holyrood.ed.ac.uk>
(message from Daniel Barker on Thu, 1 Mar 2001 20:29:35 +0000 (GMT))
Subject: Re: Penalty for immature language (PERL/BASH)
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010301105018 DOT 4534L-100000 AT is> <Pine DOT SOL DOT 4 DOT 21 DOT 0103012025260 DOT 2223-100000 AT holyrood DOT ed DOT ac DOT uk>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Newsgroups: comp.os.msdos.djgpp
> Date: Thu, 1 Mar 2001 20:29:35 +0000 (GMT)
> From: Daniel Barker <sokal AT holyrood DOT ed DOT ac DOT uk>
> 
> On Thu, 1 Mar 2001, Eli Zaretskii wrote:
> 
> > > At the BASH prompt, I launch the following PERL script, prog.pl:
> > > 
> > > while(<>)
> > > {
> > > `$_`
> > > }
> > > 
> > > If I give this a single line consisting of the word "poo", BASH performs
> > > an illegal instruction.
> > 
> > Could you please describe, for the Perl-illiterate such as myself,
> > what does this loop do, in the terms of its interaction with the OS?
> 
> In pseudocode, something like this:
> 
> WHILE (there is an unprocessed line of standard input)
> {
> 	execute that line as if typed at the shell prompt, but
> 	without printing its output;
> } 
> 
> `<command_string>` in PERL is very similar to `<command_string>` in BASH.

Does a plain `$_` (i.e. without the loop) work, or does it crash as
well?

What happens if you run your Perl script from COMMAND.COM, not from
Bash?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019