467,107 Members | 1,237 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,107 developers. It's quick & easy.

How to speed up perl scripts

I have an example script here
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. my $data = '0123456789abcdefghijklmnopqrstuvwxyz';
  4.    my @list = split //, $data;
  5.         for my $i (@list)          {
  6.         for my $j (@list)          {
  7.         for my $k (@list)          {
  8.         for my $l (@list)          {
  9.      print "$i $j $k $l\n";
  10.            }
  11.                 }
  12.                     }
  13.                        }
How i could run this script faster? Note that im not trying to use this script to brute force anything, i just think that brute force is the best way to show how can you make ur script faster
Oct 10 '08 #1
  • viewed: 2465
Share:
3 Replies
KevinADC
Expert 2GB
I don't know how you could make that run faster. Get a faster computer?
Oct 10 '08 #2
I don't know how you could make that run faster.
Thanks, i just thought that if u got the script doing same thing but just with diffrent code would make it run faster but guess not then
Oct 10 '08 #3
KevinADC
Expert 2GB
Thanks, i just thought that if u got the script doing same thing but just with diffrent code would make it run faster but guess not then
I seriously doubt you could sueeze out any performance gain from your code. But ask on www.perlmonks.com and see if someone knows something. There might be a totally different approach to printing all the 4 character permutations from the list that I am not aware of.
Oct 10 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Sandman | last post: by
42 posts views Thread by Fred Ma | last post: by
14 posts views Thread by ^ | last post: by
14 posts views Thread by Reinhold Birkenfeld | last post: by
6 posts views Thread by nntp | last post: by
reply views Thread by Kirt Loki Dankmyer | last post: by
2 posts views Thread by Chris Ochs | last post: by
12 posts views Thread by rurpy@yahoo.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.