Article View: pl.comp.lang.perl
Article #972Re: Pomocy! (Krotki programik)
From: Jaroslaw Strzalkowski
Date: Mon, 09 Feb 1998 16:15
Date: Mon, 09 Feb 1998 16:15
17 lines
1218 bytes
1218 bytes
Bartek Rajwa <rajwa@helios.mol.uj.edu.pl> wrote:
: Szanowni gurus jezyka perl!
: Sprawa jest prosta: krotki programik, ktory bedzie dokonywal zamiany
: nazw w plikach typu
: a1.xxx, a2.xxx, a3.xxx, ...., annn.xxx
: na:
: a001.xxx, a002.xxx, a003.xxx, ...., annn.xxx
Tak z palca, bez próbowania:
$nzer=$ARGV[0]; if( $nzer + 0 == 0 ) { $nzer = 3; }
for(<*.xxx>) { if(/\d+/) { rename( $_, sprintf("$`%0${nzer}d$'",$&) ); } }
Oczywiście można krócej. Hej.
--
Jaroslaw Strzalkowski, Uczelniane Centrum Informatyki AGH, Krakow
Technical Details
Message-ID:
<6bna2g$32e$1@galaxy.uci.agh.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!uucp-gw.cyf.gov.pl!news.wnaft.agh.edu.pl!agh.edu.pl!agh.edu.pl!not-for-mailReferences:
<34D98DA9.48D68A08@helios.mol.uj.edu.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!uucp-gw.cyf.gov.pl!news.wnaft.agh.edu.pl!agh.edu.pl!agh.edu.pl!not-for-mail From: Jaroslaw Strzalkowski <js@galaxy.uci.agh.edu.pl> Newsgroups: pl.comp.lang.perl Subject: Re: Pomocy! (Krotki programik) Date: 9 Feb 1998 17:15:12 +0100 Organization: University of Mining & Metallurgy Lines: 17 Message-ID: <6bna2g$32e$1@galaxy.uci.agh.edu.pl> References: <34D98DA9.48D68A08@helios.mol.uj.edu.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