Good day! I'm about to transfer our ip allocation table from openoffice spreadsheet into an ldif format. The spreadsheet has 19 columns, some cells are empty though. So far this is what I got:
#!/usr/local/bin/perl use warnings; use strict; my $input = shift @ARGV; my $output = shift @ARGV; our @attributes = ('ipNetworkNumber: ', 'Prefix: ' ,'ipNetmaskNumber: ','Range: ', 'BID: ','PID: ','ipAssignedTo: ' ,'description: ','RID: ','Region: ','Area: ','SID: ', 'ipAllocStatus: ','manager: ','ipAssignedDate: ' ,'TID: ','ipNetworkType: ','2ndOF: ','inetNum: '); open INPUT, "$input" or die $!; open OUTPUT, ">$output" or die $!; while (<INPUT>){ #this two takes care of empty cells s/:$/:NA/g; s/:(?=:)/:NA/g; foreach $field (split/:/, $_){ print OUTPUT "$field "; } } What I wanted to do is to replace the line: "print OUTPUT "$field... with something that will, upon splitting a $field, it will pair it to the content of the @attributes: For example: I have an @array = ('favorite: ', 'lessfavorite: 'worstfavorite: ') then I have a line separated with colons that has: dog:cat:bird I would then split this line and pair it one by one to the content of the array e.g; favorite: dog lessfavorite: cat worstfavorite: bird I'm really having a hard time trying to create two loops simultaneously and pair their output one by one. Hope you can help me. Thanks! __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>