Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > a numbering question

Reply
Thread Tools

a numbering question

 
 
Geoff Cox
Guest
Posts: n/a
 
      05-04-2005
Hello,

I have some images named as

pic001.gif through pic010.gif to pic200.gif

I am not clear how I can use something like

pic$number++

any pointers please!

Cheers

Geoff
 
Reply With Quote
 
 
 
 
Mark Clements
Guest
Posts: n/a
 
      05-04-2005
Geoff Cox wrote:

> Hello,
>
> I have some images named as
>
> pic001.gif through pic010.gif to pic200.gif
>
> I am not clear how I can use something like
>
> pic$number++
>
> any pointers please!
>
> Cheers
>
> Geoff


check out sprintf.

Mark
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      05-04-2005
Geoff Cox wrote:
> I have some images named as
> pic001.gif through pic010.gif to pic200.gif
> I am not clear how I can use something like
> pic$number++


Does it have to be a separate "pic" and $number or would it be possible to
increment the file name as a whole?

my $name = "pic001";
for (0..20) {
print $name++ . ".gif\n";
}

jue


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      05-04-2005
Geoff Cox <(E-Mail Removed)> wrote:

> I have some images named as
>
> pic001.gif through pic010.gif to pic200.gif
>
> I am not clear how I can use something like
>
> pic$number++
>
> any pointers please!



my $filename = sprint 'pic%03d.gif', $number++; # untested


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      05-04-2005
On Wed, 04 May 2005 13:17:38 GMT, "Jürgen Exner"
<(E-Mail Removed)> wrote:

Jue,

Thanks for your suggestion below - it made me realise my silly mistake
- I had an initial value of 1 for $number ! When I changed to 0001 all
is well.

Thanks

Geoff

>Geoff Cox wrote:
>> I have some images named as
>> pic001.gif through pic010.gif to pic200.gif
>> I am not clear how I can use something like
>> pic$number++

>
>Does it have to be a separate "pic" and $number or would it be possible to
>increment the file name as a whole?
>
>my $name = "pic001";
>for (0..20) {
> print $name++ . ".gif\n";
>}
>
>jue
>


 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      05-04-2005
On Wed, 4 May 2005 11:48:27 -0500, Tad McClellan
<(E-Mail Removed)> wrote:

> my $filename = sprint 'pic%03d.gif', $number++; # untested


Thanks Tad - will give it a try.

Cheers

Geoff

 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      05-04-2005
On 04 May 2005 19:59:15 GMT, Abigail <(E-Mail Removed)> wrote:

>Geoff Cox ((E-Mail Removed)) wrote on MMMMCCLXIV
>September MCMXCIII in <URL:news:(E-Mail Removed) om>:
>)) Hello,
>))
>)) I have some images named as
>))
>)) pic001.gif through pic010.gif to pic200.gif
>))
>)) I am not clear how I can use something like
>))
>)) pic$number++
>))
>)) any pointers please!
>
>
>$ perl -wle '$f = "pic001"; print + $f ++ . ".gif" for 1 .. 10'


Thanks - will try this out..

Cheers

Geoff

>pic001.gif
>pic002.gif
>pic003.gif
>pic004.gif
>pic005.gif
>pic006.gif
>pic007.gif
>pic008.gif
>pic009.gif
>pic010.gif
>
>
>Abigail


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about numbering modes in Canon 350D fishfry Digital Photography 2 04-14-2006 01:02 AM
numbering plan on Cisco 2600 GW Tony Cisco 0 11-19-2004 06:36 AM
DocBook - numbering sections - newbie question Richard Shea XML 7 01-16-2004 12:09 AM
numbering rows in datagrid buran ASP .Net 1 10-15-2003 01:54 PM
numbering rows in datagrid buran ASP .Net 2 07-07-2003 12:48 PM



Advertisments