[31699] in Perl-Users-Digest
Perl-Users Digest, Issue: 2962 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 24 03:09:31 2010
Date: Mon, 24 May 2010 00:09:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 24 May 2010 Volume: 11 Number: 2962
Today's topics:
Re: bit-twiddling on 32-bit machines <nospam-abuse@ilyaz.org>
Re: Conflict between 32 and 64bit (WAS: FAQ 5.6 How can <nospam-abuse@ilyaz.org>
Re: Example of the operator '..' in scalar context? <rvtol+usenet@xs4all.nl>
Re: Using rename script to change multiple files <jurgenex@hotmail.com>
Re: Using rename script to change multiple files <jurgenex@hotmail.com>
Re: Using rename script to change multiple files <tadmc@seesig.invalid>
Re: Using rename script to change multiple files <jegan473@comcast.net>
Re: Using rename script to change multiple files <jegan473@comcast.net>
Re: Using rename script to change multiple files <RedGrittyBrick@SpamWeary.invalid>
Re: Using rename script to change multiple files <nospam-abuse@ilyaz.org>
Re: Using rename script to change multiple files <xhoster@gmail.com>
Re: Using rename script to change multiple files (Seymour J.)
Re: What do N and R in $NR stand for? <reachsachin@gmail.com>
Re: Why $NR and $INPUT_LINE_NUMBER are not the same as <tadmc@seesig.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 23 May 2010 23:08:36 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: bit-twiddling on 32-bit machines
Message-Id: <slrnhvjdbk.u88.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-05-22, Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
>> And: I do not have Perl with 64-bit IV AND 64-bit NV around, so all
>> this is just a conjecture: I expect the the following things to break:
>>
>> rounding by int($n + 0.t);
> what is $n here (conceptually)?
A number.
> An integer? Then it doesn't make sense to round it.
Why? I can round 3 without any problem here...
> A floating point value? Then adding 0.5 doesn't change the
> type and whether IVs are 32 bit or 64 bit doesn't matter.
perldoc perlnumber
>> $x + 0.5 >= $x
> Again, this is already "broken" (i.e., a false assumption) on large
> numbers, making IVs 64 bit doesn't change that.
??? Are you sure you know what you are talking about?
Yours,
Ilya
------------------------------
Date: Mon, 24 May 2010 05:48:06 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Conflict between 32 and 64bit (WAS: FAQ 5.6 How can I copy a file?)
Message-Id: <slrnhvk4om.v0o.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-05-22, Ben Morrow <ben@morrow.me.uk> wrote:
>> When I tried to use File::Copy I got an error message basically stating
>> that it has been compiled for 32 bit and cannot be run on 64 bit (sorry,
>> I don't have the exact error message. Happened at work and I would need
>> to get back to the office for a repro).
>
> I presume this wasn't actually talking about File::Copy itself (which is
> pure-perl and thus portable) but about some module it loaded (probably
> Scalar::Util).
File::Copy is not pure-perl. Well, it depends on definition of
pure-perl... File::Copy may use an XSUB File::Copy::syscopy(), but
presumably this XSUB is hardwired into perl executable if present...
In pedantic mode,
Ilya
------------------------------
Date: Sun, 23 May 2010 11:44:37 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: Example of the operator '..' in scalar context?
Message-Id: <4bf8f906$0$22945$e4fe514c@news.xs4all.nl>
Tad McClellan wrote:
> This illustrates that you do yet have a clear understanding of context,
> as described in the "Context" section in
Do, or Don't?
--
Ruud
------------------------------
Date: Sat, 22 May 2010 15:24:36 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Using rename script to change multiple files
Message-Id: <s0mgv59lsu1pb1rv3k0j5b53jpk6h04sq3@4ax.com>
James Egan <jegan473@comcast.net> wrote:
>I'm trying to use the perl "rename" script to rename batches of files.
What rename script? Did you mean rename command?
>So if the files are say:
>
>0123.mov
>0124.mov
>0125.mov
>
>
>I want to rename something like:
>
>birthday-01.mov
>birthday-02.mov
>birthday-03.mov
Is there a relationship between the number 0124 the number 02? If so
which one?
Or do you just want to have consecutive numbers in your new filenames
without any relationship to the numbers in the old files?
If so then (untested)
my @oldnames = ..... #whatever way you get the old names
for (my $i = (1..@oldnames)) {
rename $oldnames[$i-1] "birthday-0$i.mov";
}
>Can this be done with regular expressions only? I was thinking of trying
>to use the seq command to get the numeric sequence part of the file names.
No, regular expressions match text, they don't rename a file.
jue
------------------------------
Date: Sat, 22 May 2010 15:34:07 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Using rename script to change multiple files
Message-Id: <4fmgv51uq8f62r9ere7amael4pijirip2l@4ax.com>
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
>On 2010-05-22, James Egan <jegan473@comcast.net> wrote:
>> 0123.mov
>> 0124.mov
>> 0125.mov
>
>> I want to rename something like:
>
>> birthday-01.mov
>> birthday-02.mov
>> birthday-03.mov
>
>> Can this be done with regular expressions only?
>
>Regular expressions may contain arbitrary code.
Really? Double-checking now.... Yes, it appears you are right:
"(?{ code })"
WARNING: This extended regular expression feature is
considered experimental, and may be changed without notice
>With pfind
>(ilyaz.org/software/tmp) which is a much improved version of `rename',
>I would do
>
> pfind -nosubdir '-var=$c' . '++$c; s/^[^.]*/birthday-$c/'
There is no code in this RE.
>Not what you want? Add a sprintf... (I would do it outside s///, but
>one can do it inside too with s///e; then one can do ++$c there
>too...)
The /e modifier doesnt' affect the regular expression but only the
substitution string.
jue
------------------------------
Date: Sat, 22 May 2010 23:27:27 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Using rename script to change multiple files
Message-Id: <slrnhvhbb5.4ca.tadmc@tadbox.sbcglobal.net>
James Egan <jegan473@comcast.net> wrote:
> I'm trying to use the perl "rename" script to rename batches of files.
What is "the perl rename script"?
I have never heard of it.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: Sun, 23 May 2010 15:00:26 GMT
From: James Egan <jegan473@comcast.net>
Subject: Re: Using rename script to change multiple files
Message-Id: <eqbKn.154656$pj7.8679@en-nntp-15.dc1.easynews.com>
On Sat, 22 May 2010 23:27:27 -0500, Tad McClellan wrote:
> James Egan <jegan473@comcast.net> wrote:
>
>> I'm trying to use the perl "rename" script to rename batches of files.
>
>
> What is "the perl rename script"?
>
> I have never heard of it.
It's part of the perl distribution, and is actually a symlink to prename:
ls -l /usr/bin/rename
lrwxrwxrwx 1 root root 24 Jul 1 2009 /usr/bin/rename -> /etc
alternatives/rename
ls -l /etc/alternatives/rename
lrwxrwxrwx 1 root root 16 Jul 3 2009 /etc/alternatives/rename -> /usr
bin/prename
dpkg -S /usr/bin/prename
perl: /usr/bin/prename
------------------------------
Date: Sun, 23 May 2010 15:10:19 GMT
From: James Egan <jegan473@comcast.net>
Subject: Re: Using rename script to change multiple files
Message-Id: <vzbKn.154657$pj7.114621@en-nntp-15.dc1.easynews.com>
On Sat, 22 May 2010 15:24:36 -0700, Jürgen Exner wrote:
> James Egan <jegan473@comcast.net> wrote:
>>I'm trying to use the perl "rename" script to rename batches of files.
>
> What rename script? Did you mean rename command?
>
>>So if the files are say:
>>
>>0123.mov
>>0124.mov
>>0125.mov
>>
>>
>>I want to rename something like:
>>
>>birthday-01.mov
>>birthday-02.mov
>>birthday-03.mov
>
> Is there a relationship between the number 0124 the number 02? If so
> which one?
> Or do you just want to have consecutive numbers in your new filenames
> without any relationship to the numbers in the old files?
No, no relationship between the numbers. The numeric portion of the file
names are generated by my digital camera, and vary. E.g., the file names
could be mvi_0925.mov, mvi_0926.mov, mvi_0927.mov.
------------------------------
Date: Sun, 23 May 2010 21:35:36 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.invalid>
Subject: Re: Using rename script to change multiple files
Message-Id: <sKqdnZZvCsoCDGTWnZ2dnUVZ8qmdnZ2d@bt.com>
On 23/05/2010 16:00, James Egan wrote:
> On Sat, 22 May 2010 23:27:27 -0500, Tad McClellan wrote:
>
>> James Egan<jegan473@comcast.net> wrote:
>>
>>> I'm trying to use the perl "rename" script to rename batches of files.
>>
>>
>> What is "the perl rename script"?
>>
>> I have never heard of it.
>
>
> It's part of the perl distribution, and is actually a symlink to prename:
So far as I can see:
Part of "the perl distribution" - No.
Part of Debian's "perl" package - Yes.
The rename/prename script is not listed at
http://perldoc.perl.org/index-utilities.html which is part of "the
official documentation from the Perl distribution(s)".
--
RGB
------------------------------
Date: Sun, 23 May 2010 23:04:53 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Using rename script to change multiple files
Message-Id: <slrnhvjd4k.u88.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-05-23, RedGrittyBrick <RedGrittyBrick@SpamWeary.invalid> wrote:
>>> What is "the perl rename script"?
>>> I have never heard of it.
>> It's part of the perl distribution, and is actually a symlink to prename:
> So far as I can see:
>
> Part of "the perl distribution" - No.
>
> Part of Debian's "perl" package - Yes.
>
> The rename/prename script is not listed at
> http://perldoc.perl.org/index-utilities.html which is part of "the
> official documentation from the Perl distribution(s)".
Some people know how to look, some do not:
K:\get-perl\perl>ls perl5.005_03/eg
ADB client findtar myrup rmfrom sysvipc van
README down g nih scan travesty who
cgi dus muck relink server unuc wrapsuid
changes findcp muck.man rename shmkill uudecode
Hope this helps,
Ilya
------------------------------
Date: Sun, 23 May 2010 18:39:12 -0700
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: Using rename script to change multiple files
Message-Id: <4bf9dfcb$0$7402$ed362ca5@nr5-q3a.newsreader.com>
Tad McClellan wrote:
> James Egan <jegan473@comcast.net> wrote:
>
>> I'm trying to use the perl "rename" script to rename batches of files.
>
>
> What is "the perl rename script"?
>
> I have never heard of it.
I was quite surprised to find it on my Asus Linux machine,
as I am used to 'rename' being a binary which does fixed string
substitutions.
/home/user> head /usr/bin/rename
#!/usr/bin/perl -w
#
# This script was developed by Robin Barker (Robin.Barker@npl.co.uk),
# from Larry Wall's original script eg/rename from the perl source.
#
# This script is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
Xho
------------------------------
Date: Sun, 23 May 2010 22:49:43 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Using rename script to change multiple files
Message-Id: <4bf9e947$2$fuzhry+tra$mr2ice@news.patriot.net>
In <sKqdnZZvCsoCDGTWnZ2dnUVZ8qmdnZ2d@bt.com>, on 05/23/2010
at 09:35 PM, RedGrittyBrick <RedGrittyBrick@SpamWeary.invalid>
said:
>So far as I can see:
>Part of "the perl distribution" - No.
Yes.
>The rename/prename script
It's not a script. Look at perlfunc.
>is not listed at http://perldoc.perl.org/index-utilities.html
Because it's a built-in function and thus doesn't belong there. Look
at <http://perldoc.perl.org/index-functions.html> instead.
--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>
Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spamtrap@library.lspace.org
------------------------------
Date: Sun, 23 May 2010 23:25:21 -0700 (PDT)
From: sachin <reachsachin@gmail.com>
Subject: Re: What do N and R in $NR stand for?
Message-Id: <9b7af850-28bb-4e81-8147-cf3cb9b63d8b@n37g2000prc.googlegroups.com>
On May 23, 1:36=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth Peng Yu <pengyu...@gmail.com>:
>
> > I know $NR is the same as $INPUT_LINE_NUMBER. But I'm wondering what N
> > and R in NR stand for.
>
> > I think R might stand for numbeR? Does N stand for iNput or liNe?
>
> I presume you are using the English module? I would recommend against
> it. Quite apart from the minor performance penalty (which can be avoided
> with newer versions of English) the puncuation names are much more
> familiar to most Perl programmers.
>
> Ben
I believe if the record separator is '\n', and which is by default,
then NR would be same as number of lines. However, if we set the
record separator or delimiter as some other character, then value of
NR might be different.
Please correct me if I am wrong.
Regards,
Sachin
------------------------------
Date: Sat, 22 May 2010 22:08:57 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Why $NR and $INPUT_LINE_NUMBER are not the same as $.?
Message-Id: <slrnhvh6nv.3dp.tadmc@tadbox.sbcglobal.net>
Peng Yu <pengyu.ut@gmail.com> wrote:
> On May 22, 2:25Â pm, "Uri Guttman" <u...@StemSystems.com> wrote:
>> >>>>> "PY" == Peng Yu <pengyu...@gmail.com> writes:
>>
>> Â PY> However, the output shows that $NR and $INPUT_LINE_NUMBER are not the
>> Â PY> same as $.. According to my understand, these three variable should be
>> Â PY> the same. Would you please let me know why they are not the same in
>> Â PY> this case? And how to make them the same?
>>
>> you need to use English to enable the spelled out variables. this is
>> documented at the very beginning of perlvar. always read that when you
>> first have a question on any of perl's builtin variables.
>>
> Sorry, I directly jumped to the description of $., and incorrectly
> assume that the three variables are the same by default.
perl itself would have helped point out your mistake, if
you had asked it to with:
use strict;
You should enable stricture in all of your Perl programs.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2962
***************************************