Hi Renqilong,

Tks for your advice.

 --- Renqilong <[EMAIL PROTECTED]> wrote: 

> > Instead of using following command printing output
> to
> > a file;
> > 
> > $ perl AAA.pl > /pathto/name_of_file
> > 
> > is it possible adding "print file function" to the
> > script
> > 
> > 1) If YES
> > Please advise how to make it.
> YES:
> open FL,"/pathto/name_of_file
> print FL WHATEVERYOUWANT

Noted with thanks.

> > 2) Can I add following bash syntax to the script
> > user=$(whoami);
> you can use:$user = `whoami`;

Noted.

> > now=$(date +%Y.%m.%d.%R);
> > File="/tmp/satimis/comparison_${user}_${now}.txt";
> 
> > 
> > so that the printout file will carry name of
> creator,
> > date and time, etc.
> > 
> > If possible please shed me some light to re-edit
> the
> > script.

> PS:maybe you should post your code first

Script:-

#!/usr/bin/perl -w
#use strict;
use warnings;

format   STDOUT_TOP=
      ORGINAL         MISTAKE      LINENO    WORDNO
.
format   STDOUT_MID=
      @<<<<<<<<<<     @<<<<<<<<<<  @##       @##
      $org,           $mis,        $lno1,    $wno
.

$orgfile='doc_a.txt';
open(INFO,$orgfile)|| die 'cannot open $orgfile';
@basedoc=<INFO>;
close(INFO);
$typfile='doc_b.txt';
open(INFO1,$typfile) || die 'cannot open $typfile';
@typedoc=<INFO1>;
close(INFO1);

$~="STDOUT_TOP";
write();

$lno=0;
$wno=0;

foreach $i (@typedoc)
{
   $incr=0;
  @typedoc1=split(/ /,$i);

       @basedoc1=split(/ /,$basedoc[$lno]);

      foreach $k (@typedoc1)
      {
            $var=$basedoc1[$incr];

         if ( $var ne $k )
          {
             $org=$var;
             $mis=$k;
             $wno=$incr+1;
             $lno1=$lno+1;
             $~="STDOUT_MID";
              write();
          }
          $incr++;
      }
   $lno++;
}
- END of SCRIPT -

B.R.
Stephen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to