Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

I need to a perl script

rajeshkumar created the topic: i need to a perl script
Hi ,

There is a file called test.txt what are all the different ways

BEGIN:
test 1
test 2 %%%%%%%%%% TEST TEST TEST
test 3
END:

need to grab all contents in between BEGIN and END:
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

rajeshkumar replied the topic: Re:i need to a perl script

Solution could be …..

#!/usr/bin/perl -w
$file=open(f, "test.txt");
$str="";
while() {$str.=$_;}
close(f);
$str =~ s/BEGIN:(.*)END:/$1/egs;
print $str

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

venu.madhav48@gmail.com replied the topic: Re:i need to a perl script

Please answer the below questions

1.What standard Perl modules have you made use of, and why did you use them instead of the equivalent built-in functions?

2.Write a statement that checks to make sure there are at least two command line arguments and exits with an error if not.

3.How do you find the number of elements in an array?

4.When an array is defined, PERL automatically numbers each element in the array
beginning with zero

venu.madhav48@gmail.com replied the topic: Re:i need to a perl script
Dear Rajesh,

Can u please help in answering the above questions

rajeshkumar replied the topic: Re:i need to a perl script

Hi Venu,

i will post this solution today evening…
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

venu.madhav48@gmail.com replied the topic: Re:i need to a perl script
Waiting for your post….

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x