AND PLEASE NOTE THAT IN PERL, THERE IS NO COMMA BETWEEN FILEHANDLE AND DATA!
Otherwise, I think, this is a strict translation of the above VB code to Perl:
#!/usr/bin/perl -w use strict; use warnings; my $testname = 'a'; Target_write_wide(1); sub Targets { return 'abc'; } sub TargetValues { return 'abc def int hun son'; } sub Target_write_wide { @_ or return; my $depth = shift; defined $depth or return; length($depth) or return; # Debug: print "Target write depth = $depth", 'Targetvalues', TargetVa +lues($depth); my $Celldata; my $Current_split = 0; my $Num_combinations = 0; my @TargetValueslist = split(' ', TargetValues($depth)); foreach (@TargetValueslist) { length($_) or next; $Celldata = "add_wide_split(\"" . Targets($depth) . "\",$_);\n"; print $Celldata; } if ($depth > 0) { Target_write_wide($depth - 1); } else { $Current_split++; $Num_combinations++; $Celldata = "run_all_wide_split(\"$testname" . "_combination:$Curr +ent_split\");"; print $Celldata; } }
Edit: I also made the assumption that Targets() and TargetValues() are functions. If those happen to be global arrays, then you need to change the parentheses to square brackets and put a dollar sign in front of the array name. But that should be easy...
In reply to Re: tO CONVERT vb SCRIPT TO PERL
by harangzsolt33
in thread tO CONVERT vb SCRIPT TO PERL
by geniuskid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |