Peter Lemus writes ..

>I'm trying to pass a variable to a system command, the
>first time it works but the second time it doesn't.
>the script looks like this:
>
>#!/usr/bin/perl
>#Editor: Peter Lemus
>#Purpose: to assign security to multiple files in
>win2k.
>print "Permissions are being changed now......\n";
>open (FILE, "dir.txt") ||  die "can't open file he:
>$!\n";
>while ($line=<FILE>) { # assign each line of imput to
>line.
>         print $line;
>        system "xcacls $line /g $line:f /e" # the
>second 
>$line does not work.

it doesn't work because at the end of $line is a newline character (you
didn't chomp it off after reading the line out of the file) .. so this is
what actually gets passed to system

  xcacls some_line
  /g some_line
  :f /e

which almost certainly will not do what you want

above the system call put this line

  chomp $line;

-- 
  jason king

  In Spearfish, South Dakota, if three or more Indians are walking down
  the street together, they can be considered a war party and fired
  upon. - http://dumblaws.com/

Reply via email to