Dec 16, 2005 #1 D davyzhu Advanced Member level 1 Joined May 23, 2004 Messages 494 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Location oriental Activity points 4,436 Hi all, I am new to Perl (I used to be a C/C++ user). And I want to write a file convertor in Perl to learn it. And I use ActivePerl. // Input.txt context s 1 2 a 4 5 a 9 8 // Output.txt context I want Sub (wire1, wire2); Add (wire4, wire5); Add (wire9, wire8); BTW, how to debug perl script in ActivePerl? can I set breakpoint in it? Any suggestions will be appreciated! Best regards, Davy
Hi all, I am new to Perl (I used to be a C/C++ user). And I want to write a file convertor in Perl to learn it. And I use ActivePerl. // Input.txt context s 1 2 a 4 5 a 9 8 // Output.txt context I want Sub (wire1, wire2); Add (wire4, wire5); Add (wire9, wire8); BTW, how to debug perl script in ActivePerl? can I set breakpoint in it? Any suggestions will be appreciated! Best regards, Davy
Dec 16, 2005 #2 B banh Advanced Member level 1 Joined Dec 16, 2004 Messages 458 Helped 17 Reputation 34 Reaction score 5 Trophy points 1,298 Activity points 3,935 if i'm not wrong activeperl only provides the interpreter on Windows. the command-based interpreter does not support debugging (e.g. breakpoint etc.) you may have to google for "Perl IDE". some are commercial, some are free. one example: **broken link removed**
if i'm not wrong activeperl only provides the interpreter on Windows. the command-based interpreter does not support debugging (e.g. breakpoint etc.) you may have to google for "Perl IDE". some are commercial, some are free. one example: **broken link removed**
Dec 16, 2005 #3 U urslen Member level 2 Joined Aug 10, 2004 Messages 45 Helped 7 Reputation 14 Reaction score 3 Trophy points 1,288 Activity points 493 Here is one script in perl which I wrote now and tested... it's working properly.. the input is t.txt file. The o/p will be o.txt. #/usr/local/bin/perl -w open(T,"<./t.txt") or die ("Could not open input file"); # input file is t.txt open(O,">./o.txt"); # The output file is o.txt foreach $line (<T>) { $line =~ s/^\s+//; if($line) { ($m,$n,$o) = split(' ',$line); if($m eq "s") {$m1=Sub;} else {$m1=Add;} print O "$m1 \(wire$n, wire$o\)\;\n"; } } close(T); close(O);
Here is one script in perl which I wrote now and tested... it's working properly.. the input is t.txt file. The o/p will be o.txt. #/usr/local/bin/perl -w open(T,"<./t.txt") or die ("Could not open input file"); # input file is t.txt open(O,">./o.txt"); # The output file is o.txt foreach $line (<T>) { $line =~ s/^\s+//; if($line) { ($m,$n,$o) = split(' ',$line); if($m eq "s") {$m1=Sub;} else {$m1=Add;} print O "$m1 \(wire$n, wire$o\)\;\n"; } } close(T); close(O);