Hi

I'm trying to design a dating website for a school assignment given a synthetic data set. I was trying to display 10 profiles per page with links to the next and previous page. I've tried a whole heap of things but it always seem to get some sort of error on the href lines. I was hoping someone could point out where i went wrong. Also, Perl seems to complain that i have unmatched curly braces when i had the right number of braces. Removing the ending brace for the while loop and the subroutine seemed to have fixed that but now i'm actually missing two braces! Here's my subroutine:

sub browse_ten { my $page = 1; # intialise number of pages my @users = glob("users_dir/*); #entire array of all the user files to be displayed. my $pages_required= ceil(($#users)/10); #calculate how many pa +ges to display while ($page le $pages_required) { my $start = ($page - 1) * 10; # index to begin display +ing them my $end = $start + 10; # show 10 results per page $end = scalar(@users) if $end > scalar(@users); # cap +the end # whether to show links if ($start > 0) { # Show a Previous link print "<a href=\"engcupid.cgi?page=" + ($page +- 1) + "\">Previous</a>"; } if (scalar(@users) > $end) { # There's more entries after what's being show +n print "<a href=>\"engcupid.cgi?page=" + ($page + + 1) + "\">Next</a>"; } # Show the range of entries. for (my $i = $start; $i < $end; $i++) { my $user_to_show = $users[$i]; $profile_filename = "$user_to_show/profile"; open $p, "$profile_filename" or die "cannot op +en $profile_filename: $!\n"; if(-r "$user_to_show/image.jpg"){ print img({src=>"$user_to_show/image.j +pg", width =>150, height=>$150}); } else { print img({src=>"blank_profile.jpg", w +idth=>150, height=>150}); } $profile = join '<br>', <$p>; $profile .= "<br>"; close $p; print $profile; } $page = $page+1;

In reply to displaying 10 results per page by squish20

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.