What does <*> mean in Perl?

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"); } 
+6
source share
2 answers
  • <> means readline(ARGV)
  • <IDENTIFIER> means readline(IDENTIFIER)
  • <$IDENTIFIER> means readline($IDENTIFIER)
  • <...> (anything else) means glob(qq<...>)

So <*> means glob(qq<*>) or glob('*') .

glob used to create multiple lines or file names from a template.

In the context of the <*> list, aka glob('*') returns all files in the current working directory other than those whose name begins with . .

+5
source

This is glob . According to perlop :

If the fact that inside the angle brackets is neither a file descriptor nor a simple scalar variable containing the file descriptor name, typeglob or typeglob, it is interpreted as a file name template, which should be globbed and either a list of file names or the next file name to list returns depending on context. This difference is determined only on syntactic grounds.

+9
source

All Articles