Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Common Beginner Mistakes

by chromatic (Archbishop)
on Dec 15, 2000 at 04:40 UTC ( #46769=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    foreach ($i = 1; $i < 10; $i++) {
        ${"record$i"} = $i * $i;
  2. or download this
    for (1 .. 10) {
        push @records, $_ * $_;
    foreach my $record (@records) {
        print $record, "\n";
  3. or download this
    my $var1 = $query->param('var1');
    my $var2 = $query->param('var2');
    my $var3 = $query->param('var3');
    my $var8 = $query->param('var8');
    my $var9 = $query->param('var9');
    my $var10 = $query->param('var10');
  4. or download this
    $report = generate_report($foo);
    open(FILE, ">>report.txt") or die "blah!";
    print FILE "Report number: $i";
    @report_lines = split(/\n/, $report);
    print FILE $report_lines[0];
    # you see where this is going
  5. or download this
    my %vars;
    for (1 .. 10) {
        $vars{"var$_"} = $query->param("var$_");
  6. or download this
    # change the form to use multiple selections with the same name
    my @vars = $query->param('var');
    # valid if you have a combobox or checkbox group
  7. or download this
        my $num_displayed = 0;
    }    # end of enclosing scope for $num_displayed

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://46769]
[Discipulus]: good morning monks! town holiday here.. but super busy
Discipulus time is not comarable with money.. when you have a roof and something to eat
[Corion]: Hi Discipulus! Busy making the town better? ;)
[Discipulus]: the house I hope.. now i'm going on the roof putting some protection for the sun. afternoon 150 km for a water polo training (son, obviously..)
[Corion]: Discipulus: Ah - lazy roof-sitting ;)
[Corion]: (well, after you've put on the sun protection ;) )

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2017-06-29 08:39 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (655 votes). Check out past polls.