help with a function

Discussion in 'Perl' started by Lizzy78, May 17, 2010.

  1. Lizzy78

    Lizzy78

    Joined:
    May 17, 2010
    Messages:
    1
    hello,

    I have to complete the code with a function but I have problems doing it.
    The function I have to write is sub getInfosBio but my code doesn't work. Can you help me? I must admit I'm not good at coding.

    Thank you
    Lizzy

    Code:
    use strict;
    use warnings;
    
    open( SOURCE1, '<', $ARGV[0] )
      or die("Impossible d'ouvrir le fichier $ARGV[0]\n");
    my @data1 = <SOURCE1>;
    close( SOURCE1 );
    
    open( SOURCE2, '<', $ARGV[1] )
      or die("Impossible d'ouvrir le fichier $ARGV[1]\n");
    my @data2 = <SOURCE2>;
    close( SOURCE2 );
    
    my $infos_bio = &getInfosBio(\@data1, \@data2);
    
    print "NOM               : " . $infos_bio->{'nom'}            . "\n";
    print "PRENOM            : " . $infos_bio->{'prenom'}         . "\n";
    print "VILLE             : " . $infos_bio->{'ville'}          . "\n";
    print "DATE DE NAISSANCE : " . $infos_bio->{'date_naissance'} . "\n";
    
    
    sub getInfosBio {
      my ($ref_arg1, $ref_arg2) = @_;
     
      my @data1 = @{$ref_arg1};
      my @data2 = @{$ref_arg2};
      
     @data1 = split (/\t: /, @data1);
     @data2 = split (/\t: /, @data2);
    
      return;
    }
     
    Lizzy78, May 17, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Vanns
    Replies:
    7
    Views:
    7,174
    Evan Carew
    Jan 21, 2004
  2. komal
    Replies:
    6
    Views:
    1,469
    msalters
    Jan 25, 2005
  3. seberino@spawar.navy.mil
    Replies:
    2
    Views:
    972
    Bengt Richter
    Aug 1, 2005
  4. Giannis Papadopoulos

    Function pointer to void function and int function

    Giannis Papadopoulos, Sep 5, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,288
    Barry Schwarz
    Sep 5, 2005
  5. weafon
    Replies:
    1
    Views:
    339
    Diez B. Roggisch
    Jul 14, 2009
Loading...

Share This Page