/[virtual-ldap]/bin/csv2yaml.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /bin/csv2yaml.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by dpavlin, Sun Mar 15 19:45:44 2009 UTC revision 11 by dpavlin, Sun Mar 15 20:01:21 2009 UTC
# Line 37  foreach my $line ( split(/\r?\n/, $csv) Line 37  foreach my $line ( split(/\r?\n/, $csv)
37    
38          warn "# fields = ",dump( @fields ) if $debug;          warn "# fields = ",dump( @fields ) if $debug;
39    
40          $hash->{ $columns[$_] } = $fields[$_] foreach ( 0 .. $#fields );          foreach ( 0 .. $#fields ) {
41                    my $n = $columns[$_];
42                    my $v = $fields[$_];
43    
44                    $v =~ s{\s*#\s*$}{};
45    
46                    if ( $v =~ m{#} ) {
47                            my @v = split(/\s*#\s*/, $v);
48                            foreach my $pos ( 0 .. $#v ) {
49                                    $hash->{ $n . '_' . $pos } = $v[$pos];
50                            }
51                    }
52                    $hash->{ $n } = $v;
53            }
54    
55          warn dump( $hash ) if $debug;          warn dump( $hash ) if $debug;
56    

Legend:
Removed from v.9  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26