Help for this page

Select Code to Download


  1. or download this
    use strict;
    
    my $infile = 'c:/RZ_Q.008';  # is it the same input file every time?
    
  2. or download this
    my ( $yr, $mo, $dy ) = (localtime)[5,4,3];
    my $outfile = sprintf( "%04d%02d%02d.txt",$yr+1900,$mo+1,$dy );
    ...
    # you can add hours and minutes, if you like -- check
    # `perldoc -f localtime`...
    
  3. or download this
    # (assign $infile, $outfile as above, open IN, OUT as in your post, th
    +en:
    
    ...
    # you'll want to figure out how to convey the proper set
    # to the script on start-up, and construct a regex along the
    # lines shown in your original code.