{"id":2521,"date":"2017-12-08T12:53:41","date_gmt":"2017-12-08T12:53:41","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2521"},"modified":"2025-02-01T23:07:59","modified_gmt":"2025-02-01T23:07:59","slug":"i-need-to-a-perl-script","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/i-need-to-a-perl-script\/","title":{"rendered":"I need to a perl script"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: i need to a perl script<\/strong><br \/>\nHi ,<\/p>\n<p>There is a file called test.txt what are all the different ways<\/p>\n<p>BEGIN:<br \/>\ntest 1<br \/>\ntest 2 %%%%%%%%%% TEST TEST TEST<br \/>\ntest 3<br \/>\nEND:<\/p>\n<p>need to grab all contents in between BEGIN and END:<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>rajeshkumar replied the topic: Re:i need to a perl script<\/strong><\/p>\n<p>Solution could be &#8230;..<\/p>\n<p><code>#!\/usr\/bin\/perl -w<br \/>\n$file=open(f, \"test.txt\");<br \/>\n$str=\"\";<br \/>\nwhile(<f>) {$str.=$_;}<br \/>\nclose(f);<br \/>\n$str =~ s\/BEGIN:(.*)END:\/$1\/egs;<br \/>\nprint $str<\/code><\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>venu.madhav48@gmail.com replied the topic: Re:i need to a perl script<\/strong><\/p>\n<p>Please answer the below questions<\/p>\n<p>1.What standard Perl modules have you made use of, and why did you use them instead of the equivalent built-in functions?<\/p>\n<p>2.Write a statement that checks to make sure there are at least two command line arguments and exits with an error if not.<\/p>\n<p>3.How do you find the number of elements in an array?<\/p>\n<p>4.When an array is defined, PERL automatically numbers each element in the array<br \/>\nbeginning with zero<\/p>\n<p><strong>venu.madhav48@gmail.com replied the topic: Re:i need to a perl script<\/strong><br \/>\nDear Rajesh,<\/p>\n<p>Can u please help in answering the above questions<\/p>\n<p><strong>rajeshkumar replied the topic: Re:i need to a perl script<\/strong><\/p>\n<p>Hi Venu,<\/p>\n<p>i will post this solution today evening&#8230;<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @<a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\"> twitter.com\/RajeshKumarIn<\/a><\/p>\n<p><strong>venu.madhav48@gmail.com replied the topic: Re:i need to a perl script<\/strong><br \/>\nWaiting for your post&#8230;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[14],"tags":[175],"class_list":["post-2521","post","type-post","status-publish","format-standard","hentry","category-perl","tag-perl"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2521"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2521\/revisions"}],"predecessor-version":[{"id":2522,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2521\/revisions\/2522"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}