Old way:

examples/advanced/open_file_old.pl
#!/usr/bin/perl
use strict;
use warnings;

my $filename = "data.txt";

open(FH, ">$filename") or die;
print FH "data";
close FH;

open(FH, $filename) or die;
my $line = <FH>;
close FH;

Recomended way:

examples/advanced/open_file_new.pl
#!/usr/bin/perl
use strict;
use warnings;

my $filename = "data.txt";

open(my $wfh, '>', $filename) or die;
print $wfh "data";
close $wfh;

open(my $rfh, '<', $filename) or die;
my $line = <$rfh>;
close $rfh;


Security problems.

Being global, difficult to pass as parameter to functions.