Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

if you just want the 3 letter combinations of the 26 lowercase letters in the English alphabet, this is pretty simple and probably very fast:

#!/usr/bin/perl -w use strict; my $size = 3; # number of characters in the target string. my $string = 'a' x $size; my $end = 'z' x $size; do { print $string++, "\n"; } while $string ne $end;

This would also work for uppercase, but as soon as you want to mix cases, add numbers, and add punctuation it falls short as a solution.

The mechanism used here is the automagical increment operator (++) which does cool stuff when applied to a string starting with a letter and consisting of letters and numbers.

Update: If you want to start with 1 character strings and go up to N characters, just change the initialization to:

my $string = 'a';
-- Eric Hammond

In reply to Re: Character Combinations by esh
in thread Character Combinations by viGuy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2023-01-30 18:54 GMT
Find Nodes?
    Voting Booth?

    No recent polls found