On Thu, 06 Nov 2003 16:33:41 +0000, drowl wrote:
> #!/usr/bin/perl -w

No big deal, but - IMO - easier to read, and it adds strict;

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

> @dataFile=<>; # read in file from command line
> @standardRules=`cat standard.for.arf.txt` ;

  my @dataFile      = <>;
  my @standardRules = `cat standard.for.arf.txt`;

Also have in mind that this is platform dependent, as there is no 'cat'
command in DOS/Windows (or on many other platforms, I would guess).

Instead of doing the whole work with open, read and close all the time,
you could do as me:  Write your own module which has a 'read_file'
function;

  sub read_file {
      my $filename = shift || '';

      my @lines = ();
      if ( $filename && -e $filename ) {
          if ( open(FILE, $filename) ) {
              @lines = <FILE>;
              close( FILE );
              chomp( @lines );
          }
      }

      return ( wantarray ) ? @lines : join("\n", @lines);
  }

This one is very simplified, but it gives you and idea.  Next time you
need to read a (text) file:

  my $text = read_file( 'text.txt' );

> #split up main / pvc info
> ($siteLink,$siteNoOfPVCs,$siteAllPVCs)=split(/:/,$site,3);

As long as we don't know what the contents of $site looks like, we can't
comment on this.

> for ($i = 0; $i < $siteNoOfPVCs ; $i++ ) { # loop for each PVC

I guess this should do the trick:

  foreach ( @sitePVCs ) {
      # ...
  }


-- 
Tore Aursand <[EMAIL PROTECTED]>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to