Help for this page

Select Code to Download


  1. or download this
    for my $line (@l){
        chomp $line;    # Remove the newline from the end
        print $line . " - processed by 'trenchwar'\n";   # Add a little co
    +ntent to each line
    }
    
  2. or download this
    for (@l){
        chomp;
        print "$_ - processed by 'trenchwar'\n";
    }
    
  3. or download this
    chomp @l;    # Remove the newline from all elements
    print map { "$_ - processed by 'trenchwar'\n" } @l;
    
  4. or download this
    open (FH3, ">lessons.txt");
    ### You should *always* check the return from any calls to the system.
    ...
    ### *And* check the return of the call. And don't pre-assume the reaso
    +n for failure:
    ### find out what it is with the '$!' (actual error) variable.
    open FH3, "lessons.txt" or die "lessons.txt: $!\n";