I normally ask questions about debugging because it seems to be an area of discontent for some Win32 users. Perhaps it is an aversion to the command line? You start a debugging session like so:
perl -d scream.pl
And you wind up in a strange screen with line numbers and package information and what-not on the left hand side. Type the letter l ("L" and not the number one) to see the current line:
DB<1> l
5==> my $text = "my text [and maybe|and here's] more text [the end|
+stop]";
6: my @arr = parseit($text);
7: print "$_\n" for @arr;
8
9 sub parseit {
...
And use b to set a breakpoint. The small letter r will run you to that breakpoint:
DB<1> b 7
DB<2> r
main::(scream.pl:7): print "$_\n" for @arr;
DB<2>
Now, to look at variables you can print them out, using p:
DB<2> p @arr
my text and maybe more text the endmy text and maybe more text stopmy
+text and h
ere's more text the endmy text and here's more text stop
DB<3>
Or, much better, you can examine them using x:
DB<3> x @arr
0 'my text and maybe more text the end'
1 'my text and maybe more text stop'
2 'my text and here\'s more text the end'
3 'my text and here\'s more text stop'
When you are done you can use the single letter q to get out of the debugging session. There is more to it, but that is the basics. Perldoc perldebug tells you all this and so much more. Give it a whirl.
Celebrate Intellectual Diversity
|