Emailid
Password
         
  
    Forgot password

New user Sign Up
 

 

Any trouble with the code??                            

Author Name Status Posted Time
Saul Toropein 12/14/2007 2:26:05 AM
Author is Offline

can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just the number. whats wrong with my code?

Code: ( perl )
  1. #!/usr/bin/perl
  2. use Fcntl;
  3. @array = (a..z);
  4. srand;
  5. foreach (1..5)

  6. {
     
     
  7. $name = int(rand scalar(@array))
     
  8. print $array[$name]
     
  9. splice(@array,$name,1)
     
  10. }
  11. print "content-type: text/perl \n\n";
  12. [B]sysopen (PERL, "$name.pl", O_RDWR|O_EXCL|O_CREAT, 0755);[/B]
  13. printf PERL '#!/usr/bin/perl';
  14. printf PERL "\n\n";
  15. printf PERL 'print "hello world!";';
  16. printf PERL "\n";
  17. printf PERL 'sleep(3);';
  18. close (PERL);
 

Subject Author Status Date

Re: Any trouble with the code??

Kelpein Petcull 12/15/2007 2:52:14 AM

Re: string of 5 letters

Saul Toropein 12/15/2007 2:54:36 AM

Re: No idea, sorry

Kelpein Petcull 12/15/2007 2:55:48 AM

Re: Thank you!!!

Saul Toropein 12/15/2007 2:57:08 AM

Re: Only printed the random strings

Kelpein Petcull 12/15/2007 2:59:05 AM
Related Forums
Yes, the Site Only!!
The PHP Zend File had been Cracked!!!
Any Help with Coldfusion??
Any Way to Define a Method from Outside the Class
Any Way to Define a Method from Outside the Class





Home | About Us | Site Map | Privacy Policy