How do you debug a Perl scripting ( at the compile time
error or run
time error) in Unix environment ?
Answers were Sorted based on User's Feedback
Answer / kuldip singh behal
we can also use -c and -d switches to debug our perl scripts
ex:
perl -c sample.pl (for compilation errors)
perl -d sample.pl (for debugging the code line by line)
Is This Answer Correct ? | 8 Yes | 1 No |
Answer / hemalata
For debugging perl scripting u can use
1. diagnostic modules - which can help us isolate and
understand problems with our code.
EX- use warning, use strict, use diagnostics
2.perl command line switches - u can create test programm
using the perl command line.
Ex-i) #!user/bin/perl -w
or on the command line like this
>perl -w program.plx
ii) -e = it tells the perl not to load and run a program
file but to run the text following -e as a program.
> perl -e "print \"hello World \n";"
iii)-c = stops perl from running your program instead ,al it
does is check that code can be complied as valid perl.
its a good way to quickly check that a program has no
glaring syntax errors.
> perl -ce 'print "hello,world\n";'
and so on it will available Google u can search ........
3. debugging techniques and perl de-debugger - how to remove
the problems that we've found.
Using debugger
> perl -d filename.plx
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / sirisha
by using strict and warnings, or by putting some print
statements
Is This Answer Correct ? | 3 Yes | 3 No |
Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?
What are the different ways to run cgi?
What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
How to renaming a file in perl programming?
What are scalars?
Why aren't Perl's patterns regular expressions?
how to find a substring in a string without using substr built in functions, and print the substring found
How to implement a stack in Perl?
Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?
What are the different string manipulation operators in perl?
my @array=('data1','data2'); my @array1=('data1','data2'); my ($i,$k); $i=7; $k=7; while($i){ $array [++$#array] = 'ree'; $i--; print "@array"; } while($k){ push(@array1,'ree'); $k--; print "@array1"; } Are these two while loop are doing the same functionality ? What may be the difference?
Is perl a case sensitive language?