Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: "open" Best Practices

by Eily (Monsignor)
on Jul 11, 2019 at 15:53 UTC ( #11102693=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open my $input, '<', "my_input.xml" or die "Can't open my_input.csv: $
    +!"; # Whoops, my_input.xml does not exist by my_input.csv file does
    
    my $input_file = "my_input.xml";
    open my $input, '<', $input_file or die "Can't open $input_file: $!"; 
    +# Still doesn't work but the error message is correct
    
  2. or download this
    my $file = get_file(); 
    my $folder = get_folder(); # The function returned an empty string by 
    +mistake
    ...
    
    my $input_file = "$folder/$input";
    open my $data, '<', $input_file or die "Can't open $input_file: $!"; #
    + You'll see straightaway that you the folder is empty
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11102693]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2020-02-20 01:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (86 votes). Check out past polls.

    Notices?