On Nov 16, Sherri said:

>Please tell me if this is the correct program for making attribute
>codes. In this program I need to do like a form with an employee's name,
>age, position and start date. This is the way I wrote it. Please tell me
>what is missing or incorrect.

Most people would use a hash for this.  That way, you can access 'name'
instead of $name_field.

>#!/usr/bin/perl -w
>use strict;

Good move.

>$name_field = 0; $age_field = 1; $position_field = 2; $start_date = 3;
>@employee = ("John Doe", 32, "Software Engineer", "10/12/2000");

But you didn't declare ANY of those variables.

  my ($name_f, $age_f, $pos_f, $date_f) = (0 .. 3);
  my @employee = ("John Doe", 32, "Software Engineer", "10/10/2000");

Or, using a hash, you don't need those four $..._f variables:

  my %employee = (
    name => "John Doe",
    age => 32,
    position => "Software Engineer",
    start_date => "10/10/2000",
  );

  print $employee{age};

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to