I must be doing something wrong with this script.... my $pcname = 'ACME0001'; while ( $pcname < 5 ) { print "$pcname \n"; $pcname++; }
I get these results ACME0001 1 2 3 4 -----Original Message----- From: Wagner, David --- Senior Programmer Analyst --- WGO [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 11:50 AM To: James Edward Gray II; Meneses, Alden Cc: [EMAIL PROTECTED] Subject: RE: How do I increment a alphanumeric value? James Edward Gray II wrote: > On Mar 12, 2004, at 1:39 PM, Meneses, Alden wrote: > >> Suppose I have machines that are ACMExxxx >> >> I want to go from ACME0001 to ACME9999 > > How's this? If you have it in a variable then you only need ++ to get to the next item: my $MyMachines = 'ACME0001'; # to get the next item $MyMachines++; Seems to simple, but ran a test and it works just like that. Wag ;) > > foreach (1..9999) { > printf "ACME%4d\n", $_; > } > > James Any questions and/or problems, please let me know. Thanks. Wags ;) Int: 9-8-002-2224 Ext: 408-323-4225x2224 ********************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. **************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>