in reply to Re: Formatting randomised data
in thread Formatting randomised data

You can leave out the "int" if you already have "%d", because that "int"'s it:
my $random = sprintf "%04d", rand 10000;
And yes, you're off by one if you use 9999, because you'd never have 9999. {grin}

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^3: Formatting randomised data
by tlm (Prior) on Jun 19, 2005 at 20:38 UTC
    my $random = sprintf "%04d", 1 + rand 9999

    per spec :)

    the lowliest monk

A reply falls below the community's threshold of quality. You may see it by logging in.