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:
Elementary:
@file_names=glob('*.txt');
for($i=0;$i<=$#file_names;$i++)
{
unlink($file_names[$i]);
}
- Original Message -
From: "Kliment Andreev" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 21, 2001 2:24 PM
Subject: Passing parameters to unlink
> Hi,
>
> I am a
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 mailin
$childpid = fork();
if (! $childpid){
# this is the child process, so exec the command
exec("command");
# OR, call system(), which will fork again and wait for
# the child to complete, while the parent process goes
# on its merry way...
}
-Peter
-Original Message-
From: P
Thanks Shawn
Never thought about using a pipe. HOW SIMPLE!!!
-Original Message-
From: Poulson, Shawn [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 3:44 PM
To: 'Conrad, Bill (ThomasTech)'; [EMAIL PROTECTED]
Subject: RE: Using EXEC to force execution in Background on
> Is there a way on UNIX to force the execution of an external command
> from the EXEC function to be run in background?
Are you REALY sure you mean exec() ???
>From perldoc -f exec
exec LIST
exec PROGRAM LIST
The "exec" function executes a system command *and never
from Unix you can do this:
system("echo command | at now");
-Original Message-
From: Conrad, Bill (ThomasTech) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 3:38 PM
To: [EMAIL PROTECTED]
Subject: Using EXEC to force execution in Background on UNIX.
Hi All
Is the