-
Junior Member
Number of lines in a PERL script
How do I check number of lines in script in PERL?
Thanks
-
Contributing Member
Re: Number of lines in a PERL script
One fairly efficient way is to count newlines in the file.
----------------------
suresh
-
Junior Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules