Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Number of lines in a PERL script within the PERL forums, part of the Web Development category; How do I check number of lines in script in PERL? Thanks...
|
|||||||
| PERL PERL Scripts - Tips, Tricks, Issues, Latest News, PERL Resource and PERL related topics can be discussed in this forum. |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
Re: Number of lines in a PERL script
hi
you can add ( print __LINE__ ; ) statement at the end of your script it will display how many lines are there in the script. For e.g #!/usr/bin/perl use strict; my @array=qw(hello World Show must go on); my $first_str; my $second_str; my @rev_sorted=reverse( sort { lc $second_str cmp lc $first_str } @array) ; print "\n Rev_Sorted array:@rev_sorted"; my $count=scalar @array; print "\n Count :$count"; print "\n $array[($count/2)] \n"; print __LINE__; Ans is: 16 |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| about PERL... | psuresh1982 | PERL | 5 | 09-04-2007 11:04 PM |
| How is PERL helpful for testers | Geek_Guest | Career Advice | 0 | 06-28-2007 04:10 AM |
| Getting a list of ipaddress from the array using perl | anushya | Scripting | 1 | 02-10-2007 02:42 AM |
| Points and lines | smart_coder | Brainteasers | 8 | 01-25-2007 02:00 PM |
| Need Forums or PERL/PYTHON | kalayama | Suggestions & Feedback | 3 | 12-21-2006 09:14 PM |