Can someone help me understand this syntax of open function in Perl File I/O ?
open(FHANDLE, ">" . $file )
This is an example of the old, two-argument form of
open (which should be avoided now that three-argument
open is available). In Perl,
. is the append operator. It combines the two strings into a single string.
The line of code you posted is equivalent to
open(FHANDLE, ">$file" ), it just uses a different method of combining the
The better way to do it these days would be
open(my $fhandle, '>', $file), as shown in the documentation you linked to.