Not tested:

        while ( 1 ) {
                printf "Please enter length of variable(ex:exit out): ";
                chomp(my $MyInp = <STDIN> );
                last if ( $MyInp =~ /^ex$/i );
                if ( $MyInp !~ /\d+/ ) {
                   print "Expecting only digits, but got <$MyInp>." ,
"\n";
                   next;
                 }
                my $MyVar = q[a]x$MyInp;
                printf "<%s>\n", $MyVar;
         }

          If you have any problems or questions, please let me know.

     Thanks.

  Wags ;)
David R Wagner
Senior Programmer Analyst
FedEx Freight
1.408.323.4225x2224 TEL
1.408.323.4449           FAX
http://fedex.com/us 
 

> -----Original Message-----
> From: Travis Thornhill [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 19, 2007 14:37
> To: beginners@perl.org
> Subject: How do I create this string?
> 
> I need to make strings of variable length for testing inputs.
>   The strings can contain any letter, say 'a', and I need to 
> be able to create the string with
>   255, 256 or any length.
>    
>   Is there a quick and easy way to do this with perl?
> 
>  
> ---------------------------------
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
> 

**********************************************************************
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/


Reply via email to