> 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' );
>

nice... how ever i hope to turn this into a sub with  $site as input
and $siteIP and $siteString as output + the arf file of course

but maybe i can use this in the main proggi..

>> #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.

$site would look like:
127.0.0.1,comunityString,sitename,group,e23,20000:2:bsite,21,p235,32000;csite,22,p523,64000

>
>> for ($i = 0; $i < $siteNoOfPVCs ; $i++ ) { # loop for each PVC
>
> I guess this should do the trick:
>
>   foreach ( @sitePVCs ) {
>       # ...
>   }
>
>
humm then would i just use ...=split(/,/,$_,4);  ???


> --
> Tore Aursand <[EMAIL PROTECTED]>
>
>
>


Thanks
   Ritch
-- 
fnord
yes im a Concord Engineer, no it never flown!



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

Reply via email to