#!/usr/bin/perl use strict; use Data::Dumper; use Text::CSV; my $csv = Text::CSV->new(); my %hash_temp; while (my $line = <DATA>) { next if ( $line =~ /^\"create_stamp\"/ ); $csv->parse( $line ); my @cols = $csv->fields(); $hash_temp{"dn: uid="} = lc( $cols[1] ); $hash_temp{"givenName: "} = $cols[2]; $hash_temp{"sn: "} = $cols[3]; $hash_temp{"telephoneNumber: "} = $cols[8] . "-" . $cols[6] if ( $ +cols[7] == 0 ); $hash_temp{"faxNumber: "} = $cols[8] . "-" . $cols[6] if ( $cols[7 +] == 1 ); } print Dumper( \%hash_temp ); __DATA__ "create_stamp","username","first_name","last_name","name","name","exte +nsion","fax_flag","exchange","position","username" "2009-03-02 15:31:52","SimpsonH","Homer","Simpson","Nuclear Control Ce +nter","Radioctive Hall","6798","1","218 555","Nuclear Control Operato +r","BurnsM" "2009-03-02 15:31:52","SimpsonH","Homer","Simpson","Nuclear Control Ce +nter","Radioctive Hall","6793","0","218 555","Nuclear Control Operato +r","BurnsM"
In reply to Re: Manipulating Data by a Field Identifier
by bichonfrise74
in thread Manipulating Data by a Field Identifier
by rycher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |