All pastes #1992044 Raw Edit

dpecka

public text v1 · immutable
#1992044 ·published 2010-11-15 10:47 UTC
rendered paste body
[?1049h[?1h=[?12;25h[?12l[?25h[?25l"cargo_ldap.pl" 78L, 1307Cuse strict;
use warnings;

my $csv_file="@ARGV";
my %struct_hash;

##### functions


sub read_csv { my @csv; open my $fh, "$csv_file" or die "bad file: \"$csv_file\" - can't open\n"; push(@csv, "$_") while(<$fh>); close $fh; return @csv;
};

sub build_struct_hash { my %struct_hash; foreach(read_csv()) { my($pos_xy, $pos_str) = split(/;/, "$_"); $pos_xy =~ s/\D//g; $pos_str =~ s/\r//g; chomp($pos_str); $struct_hash{$pos_xy} = {}; $struct_hash{$pos_xy}->{'str'} = $pos_str; }; return %struct_hash;
};

sub get_parent_id { my $len_tmp = length($_[0]); my $plen = 2; my $incr = 2; my $len; $len = 2 if length($_[0]) == 2; while($plen < $len_tmp) { $len = $plen; $plen = $plen + (2*$incr); $incr++; }; return substr($_[0], 0, $len);
};46,0-13%[?12l[?25h[?25l
Type  :quit<Enter>  to exit Vim46,0-13%[?12l[?25h[?25l46,0-13%[?12l[?25h[?25l46,0-13%[?12l[?25h[?25l46,0-13%[?12l[?25h[?25l:[?12l[?25h:[?25l[?12l[?25h:[?25l[?12l[?25h^Z[?25l[?12l[?25h^Z[?25l[?12l[?25h
[?25lE492: Not an editor command: ::^Z^Z46,0-13%[?12l[?25h[?25l
########### main body:47,16%[?12l[?25h[?25l
48,0-19%[?12l[?25h[?25l
%struct_hash = build_struct_hash();49,112%[?12l[?25h[?25l
50,0-115%[?12l[?25h[?25l
########## user body:51,118%[?12l[?25h[?25l
52,0-121%[?12l[?25h[?25l:[?12l[?25hq[?25l[?12l[?25h
[?25l[?1l>[?12l[?25h[?1049l