Help for this page

Select Code to Download


  1. or download this
    my @list;
    #Read first, ask questions later is probably not optimal for this
    ...
    #Map is good, nice way to get all the newlines back
    #join would work if you the file need not end in a newline
    print map {"$_\n"} @list;
    
  2. or download this
    my @list;
    while(chomp(my $line = <NETLIST>)){
    ...
      $line =~ s/^\+// ? $list[-1] .= $line : push(@list, $line);
    }
    print map {"$_\n"} @list;
    
  3. or download this
    my @list;
    #for is very perlish, so is using $_
    chomp && $_ =~ s/^\+// ? $list[-1] .= $_ : push(@list, $_) for <NETLIS
    +T>;
    print map {"$_\n"} @list;