a numbering question

G

Geoff Cox

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
 
M

Mark Clements

Geoff said:
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
 
J

Jürgen Exner

Geoff said:
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
 
T

Tad McClellan

Geoff Cox said:
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
 
G

Geoff Cox

On Wed, 04 May 2005 13:17:38 GMT, "Jürgen Exner"

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
 
G

Geoff Cox

Geoff Cox ([email protected]) wrote on MMMMCCLXIV
September MCMXCIII in <URL:)) 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top