Friday, 27 February 2015

Sample PERL program to illustrate file read and file write operations

#!/usr/bin/perl

use strict;
use warnings;

if(@ARGV < 2)
{
  print "Please provide 2 file names\n";
  exit;
}

open my $IFILE, "<", $ARGV[0];
open my $OFILE, ">", $ARGV[1];

while(<$IFILE>)
{
  print $OFILE $_;
}

No comments:

Post a Comment