🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.perl
Article #1192

Re: Pytanie o exec w perlu.

#1192
From: Piotr Piatkowski
Date: Tue, 07 Apr 1998 12:17
26 lines
1468 bytes
rafal wiosna <raf@NOSPAM.polbox.pl> wrote:
: * Jerzy Orzeszek <Jerzy.Orzeszek@univcomp.waw.pl> wrote:
:  > {
:  > print "Program ropoczyna kopiowanie:\n";
:  > print "Proszę podać katalog Ÿródłowy:\n";
:  > 	$s = <STDIN>;
:  > 	exec "cp $u /home/user/katalog";
:  > }

: 	Najprościej tak:
: 	
: 	$tmp = `cp $u ..`;

Nie, nie, nie! man perlstyle:

 o Avoid using grep() (or map()) or `backticks` in a void context, that
   is, when you just throw away their return values. Those functions all
   have return values, so use them. Otherwise use a foreach() loop or the
   system() function instead.

Czyli - jeżeli nie potrzebujesz tego co wypisze cp, to zrób tak:

system( "cp $u .." );

-- 
Piotr Piątkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND
Technical Details
Message-ID: <6gd5gg$8bl$1@galaxy.uci.agh.edu.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!lublin.pl!news.onet.pl!agh.edu.pl!agh.edu.pl!not-for-mail
References: <352A15CB.82BA3FFF@univcomp.waw.pl> <6gd1nm$k9d$1@news.polbox.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!lublin.pl!news.onet.pl!agh.edu.pl!agh.edu.pl!not-for-mail
From: Piotr Piatkowski <kompas@galaxy.uci.agh.edu.pl>
Newsgroups: pl.comp.lang.perl
Subject: Re: Pytanie o exec w perlu.
Date: 7 Apr 1998 14:17:20 +0200
Organization: University of Mining & Metallurgy
Lines: 26
Message-ID: <6gd5gg$8bl$1@galaxy.uci.agh.edu.pl>
References: <352A15CB.82BA3FFF@univcomp.waw.pl> <6gd1nm$k9d$1@news.polbox.pl>
NNTP-Posting-Host: galaxy.uci.agh.edu.pl
Mime-Version: 1.0
X-Newsreader: TIN [UNIX 1.3 unoff BETA 971018; sun4m SunOS 5.5.1]
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit