Good idea. Well done. But you don't really need the extra last-number file. You can determine it on-the-fly. Hope the following code helps: The script will first look for sample_<number>.pl files, extract the biggest number, and start the next file with filename of sample_<last number + 1>.pl.

#!/usr/bin/perl -w use strict; use IO::Dir; my $rootdir = "."; my $lastno = GetLastNumber($rootdir) + 1; my $newpl = "$rootdir/sample_${lastno}.pl"; # forgot to add .pl extens +ion # thanks jweed. system "vim $newpl && rm current_test && ln -s $newpl current_test"; sub GetLastNumber { my $dir = shift; my $d = IO::Dir->new($dir) or die "Can not open directory $dir for read!"; my $lastno = 0; while (defined(my $f = $d->read)) { next if $f !~ /sample\_\d+\.pl/; my ($no) = $f =~ /sample_(\d+)\.pl/; $lastno = $no if $no > $lastno; } return $lastno; }

In reply to Re: Perl test management by Roger
in thread Perl test management by jweed

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.