In the code below, what exactly does the <*>
command do?
my @usbHddFileList = <*>;
foreach $usbHddFile (@usbHddFileList)
{
system("rm -f $curMountDir/$usbHddFile < /dev/null > /dev/null 2>&1");
}
$! If used in a numeric context, yields the current value of the errno variable, identifying the last system call error. If used in a string context, yields the corresponding system error string.
Advertisements. Variables are the reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory.
It's a glob. According to perlop:
If what's within the angle brackets is neither a filehandle nor a simple scalar variable containing a filehandle name, typeglob, or typeglob reference, it is interpreted as a filename pattern to be globbed, and either a list of filenames or the next filename in the list is returned, depending on context. This distinction is determined on syntactic grounds alone.
<>
means readline(ARGV)
<IDENTIFIER>
means readline(IDENTIFIER)
<$IDENTIFIER>
means readline($IDENTIFIER)
<...>
(anything else) means glob(qq<...>)
So <*>
means glob(qq<*>)
or glob('*')
.
glob
is used to generate a number of strings or file names from a pattern.
In list context, <*>
aka glob('*')
returns all the files in the current work directory other than those whose name starts with .
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With