By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

How to speed up perl scripts

P: 31
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
Share this Question
Share on Google+
3 Replies


KevinADC
Expert 2.5K+
P: 4,059
I don't know how you could make that run faster. Get a faster computer?
Oct 10 '08 #2

P: 31
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 2.5K+
P: 4,059
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.