Help for this page

Select Code to Download


  1. or download this
    $ perl -Mstrict -Mwarnings -le 'print "C:\windows\file.txt"'
    Unrecognized escape \w passed through at -e line 1.
    C:windows
             ile.txt
    
  2. or download this
    $ perl -Mstrict -le 'print "C:\windows\file.txt"'
    C:windows
             ile.txt
    
  3. or download this
    $ perl -Mstrict -Mwarnings -le 'print "C:\\windows\\file.txt"'
    C:\windows\file.txt
    
  4. or download this
    $ perl -Mstrict -Mwarnings -le 'print q{C:\windows\file.txt}'
    C:\windows\file.txt
    
  5. or download this
    $ perl -Mstrict -Mwarnings -le 'print qq{C:\windows\file.txt}'
    Unrecognized escape \w passed through at -e line 1.
    C:windows
             ile.txt
    
  6. or download this
    $ perl -Mstrict -Mwarnings -e 'my $PATH = q{not_a_file}; open fh $PATH
    +'
    Can't locate object method "fh" via package "not_a_file" (perhaps you 
    +forgot to load "not_a_file"?) at -e line 1.
    
  7. or download this
    open my $fh, '<', $path or die "Can't open $path: $!";
    
  8. or download this
    # Uncomment ONLY ONE of these:
    #my $path = 'C:\windows\path\to\filename';
    ...
    
    # Now open your chosen file for reading:
    open my $fh, '<', $path or die "Can't open $path: $!";