On 12/16/2003 11:04 PM, Eric Edwards wrote:

----- Original Message ----- From: "Randy W. Sims" <[EMAIL PROTECTED]>
To: "Eric Edwards" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, December 16, 2003 9:35 PM
Subject: Re: unlink




On 12/16/2003 10:14 PM, Eric Edwards wrote:


Hey Listers-
This is not homework.  I am teaching myself perl.
Question:
Does the unlink command not work on windows?  The book I am using has

some


code examples using it but I am wondering if it might be UNIX specific.

I


hope my code isn't that bad.
Thanks!
Eric


unlink works fine on Windows. What code is failing?


unlink 'filename' or die $!;

Randy.


> I tried both of these:
> foreach (@ARGV) {
>    unlink $_ or warn "Can't unlink '$_': $! \n";
> }
> also:
> foreach my $file qw(slate bedrock lava)) {
>    unlink $file of warn "failed on $file: $!\n";
> }
> i entered these file names in my directory.
> Thanks,
> Eric

What is the output?

-----><8-----
#!/usr/bin/perl
use strict;
use warnings;

use Cwd;

print 'In directory ' . cwd() . "\n";
foreach (@ARGV) {
  print "unlinking $_\n";
  unlink or warn;
}

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to