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



How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environm..

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

How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environm..

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

How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environm..

Answer / manohar

#! /usr/bin/perl -d

Is This Answer Correct ?    5 Yes 0 No

How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environm..

Answer / sirisha

by using strict and warnings, or by putting some print
statements

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More CGI Perl Interview Questions

What is the difference between use and require in perl programming?

0 Answers  


Consider the following example #! /bin/perl use strict; sub sample { my @arr=(1,2,3,4); return @arr; } my ($a,$b,$c,$d) = &sample; print "$a\n$b\n$c\n$d\n"; In the above code, How can I get the $c without using the arguments such as $a,$b. I don't want to use any array to get the return values.

2 Answers  


How to replace perl array elements?

0 Answers  


List the data types that Perl can handle?

0 Answers  


What is subroutine in perl?

0 Answers  






How can memory be managed in Perl?

0 Answers  


What is warn function in perl?

0 Answers  


What are the benefits of perl in using it as a web-based application?

0 Answers  


You want to open and read data files with perl. How would you do that?

0 Answers  


Define operators used in perl?

0 Answers  


what are the two ways to get private values inside a subroutine or block?

0 Answers  


Why to use perl scripting?

0 Answers  


Categories