#!/usr/bin/perl use warnings; use strict; my $file = shift or die; open (FH,">$file") or die; for(1..1000){ my $first = sprintf('%03d', int rand 999); my $second = sprintf('%03d', int rand 999); my $third = sprintf('%04d', int rand 9999); print FH "$first-$second-$third\n"; }