It doesn't look like you are setting the $_ variable anywhere.  Maybe if you
put this line in after the opendir and before the first bracket:

foreach(readdir(DIR))

and closed the bracket

-----Original Message-----
From: Harry Putnam [mailto:[EMAIL PROTECTED]
Sent: Monday, July 07, 2003 12:59 PM
To: [EMAIL PROTECTED]
Subject: readdir unlink any symlinks


I'm pretty sure there is a nifty thrifty way to do this rather than
tying myself in knots like this:

I want to unlink and symlinks that might be in a specific directory.
A snipped from hack-a-thonic script:

my $mnsd = "/tmp/mns";
if(! -d $mnsd){
     mkdir $mnsd or die "Can't mkdir $mnsd; $!";
}else{
   opendir(DIR, $mnsd) or die "can’t opendir DIR: $!";
   { my $target = $mnsd . "/" . $_;
   unlink $target if (-l $target)} readdir(DIR);

}
close(DIR);

Error this formulation gives is:
Use of uninitialized value in concatenation (.) or string at
/cvsb/reader/home/reader/scripts/perl/sym.pl line 22.

Its not $mnsd so wondering what.


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

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

Reply via email to