unlink takes a list, so you can just give it an array. You need to glob the
filespec to get an array, and assign it to an array (@), rather than a
scalar ($), or you will be trying to remove a file which (hopefully) doesn't
exist, rather than the list of files you thought you were getting.
try:
unlink glob "*.txt" ;
or if you need to save the list for later:
@filelist = glob "*.txt" ;
unlink @filelist ;
HTH!
Craig Arnold
> -----Original Message-----
> From: Kliment Andreev [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, August 21, 2001 2:25 PM
> To: [EMAIL PROTECTED]
> Subject: Passing parameters to unlink
>
> Hi,
>
> I am a newbie in Perl and I have a trivial question.
>
> How can I pass parameter to unlink function?
>
> Example:
>
> $filelist="*.txt";
> unlink <$filelist>; or unlink <"$filelist"> does not work. :(
>
> Help!
>
> Thank you,
> Kliment Andreev
>
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/activeperl
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl