Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: Substitute ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 11 of 12 Topic 10952 of 12261
Post > Topic >>

Re: Substitute Variably hort string into long string at Right Justified

by rob.dixon@[EMAIL PROTECTED] (Rob Dixon) Apr 20, 2008 at 12:38 PM

Chas. Owens wrote:
> On Sat, Apr 19, 2008 at 1:57 PM, Rob Dixon <rob.dixon@[EMAIL PROTECTED]
> wrote:
>> Chas. Owens wrote:
>>  > On Sat, Apr 19, 2008 at 1:03 PM, Rob Dixon <rob.dixon@[EMAIL PROTECTED]
>
wrote:
>>  > snip
>>  >>  foreach my $i (1 .. 9999) {
>>  >>   my $zfill = substr("0000$i", -4);
>>  >>   my $longer = "dbt${zfill}dsfg";
>>  >>   print $longer, "\n";
>>  >>  }
>>  >>
>>  >>  Rob
>>  > snip
>>  >
>>  > TIMTOWTDI fight!
>>  >
>>  > for my $i (1 .. 9999) {
>>  >     my $longer = "0" x (4 - length $i) . $i;
>>  >    print "$longer\n";
>>  > }
>>
>>  You're on!
>>
>>
>>  foreach my $i (1 .. 9999) {
>>   (my $longer = $i + 10000) =~ s/1(....)$/dbt$1dsfg/;
>>   print $longer, "\n";
>>  }
>>
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> for my $i (1, 10, 100, 1000) {
>         chop(my $longer = reverse(10000 + $i));
>         print scalar reverse($longer), "\n";
> }

You've changed the problem! If we're allowed to solve that one instead,
then I submit

  my $longer = reverse '0000' | reverse "$i";

Rob
 




 12 Posts in Topic:
Substitute Variably hort string into long string at Right Justif
pgn674@[EMAIL PROTECTED]   2008-04-17 01:14:31 
Re: Substitute Variably hort string into long string at Right Ju
chas.owens@[EMAIL PROTECT  2008-04-17 07:48:18 
Re: Substitute Variably hort string into long string at Right Ju
Jenda@[EMAIL PROTECTED]   2008-04-17 15:07:51 
Re: Substitute Variably hort string into long string at Right
pgn674@[EMAIL PROTECTED]   2008-04-17 16:51:10 
Re: Substitute Variably hort string into long string at Right Ju
rob.dixon@[EMAIL PROTECTE  2008-04-18 18:38:32 
Re: Substitute Variably hort string into long string at Right Ju
chas.owens@[EMAIL PROTECT  2008-04-19 13:12:16 
Re: Substitute Variably hort string into long string at Right Ju
rob.dixon@[EMAIL PROTECTE  2008-04-19 18:57:16 
Re: Substitute Variably hort string into long string at Right Ju
rob.dixon@[EMAIL PROTECTE  2008-04-19 18:03:45 
Re: Substitute Variably hort string into long string at Right
Uri Guttman <uri@[EMAI  2008-04-19 17:49:16 
Re: Substitute Variably hort string into long string at Right Ju
chas.owens@[EMAIL PROTECT  2008-04-19 14:53:06 
Re: Substitute Variably hort string into long string at Right Ju
rob.dixon@[EMAIL PROTECTE  2008-04-20 12:38:03 
Re: Substitute Variably hort string into long string at Right Ju
chas.owens@[EMAIL PROTECT  2008-04-20 10:18:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 17:45:28 CST 2008.