Help for this page

Select Code to Download


  1. or download this
    my $file = 'books/bookLIST.txt';
    open my $info, '<', $file or die "Could not open $file: $!";
    my @lines = <$info>;
    close $info;
    
  2. or download this
    my @vlinks;
    for my $line (@lines) {
    ...
    
    use Data::Dump;
    dd \@vlinks;
    
  3. or download this
    @vlinks = sort {
               $a->{title}  cmp $b->{title}
            or $a->{pages}  <=> $b->{pages}
            or $a->{author} cmp $b->{author}
        } @vlinks;
    
  4. or download this
    for my $vlink (@vlinks) {
        print "<tr><td><a href=\"bookDETAIL.cgi?book=$vlink->{title2}\">"
            ."$vlink->{title}</a></td><td>$vlink->{pages}</td>"
            ."<td>$vlink->{author}</a></td></tr>\n"
    }
    
  5. or download this
    use Text::CSV;
    
    ...
    }
    $csv->eof or $csv->error_diag;
    close $info;
    
  6. or download this
    use HTML::Entities qw/encode_entities/;
    for my $vlink (@vlinks) {
    ...
            .encode_entities($vlink->{pages})."</td><td>"
            .encode_entities($vlink->{author})."</td></tr>\n"
    }