Help for this page

Select Code to Download


  1. or download this
           How can I use Perl's "-i" option from within a program?
    
    ...
                # $^I and @ARGV return to their old values here
    
           This block modifies all the ".c" files in the current directory
    +, leaving a backup of the original data from each file in a new ".c.o
    +rig" file.
    
  2. or download this
    # Long, understandable version
    $old_fh = select(OUTPUT_HANDLE);
    ...
    
    # Short version
    $^I = '.orig', select $_ for select OUTPUT_HANDLE;