<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Perl Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/category/perl/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/category/perl/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Mon, 19 Jun 2023 13:29:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Top 50 Perl Interview Questions with Answers</title>
		<link>https://www.scmgalaxy.com/tutorials/top-50-perl-interview-questions-with-answers/</link>
					<comments>https://www.scmgalaxy.com/tutorials/top-50-perl-interview-questions-with-answers/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Mon, 01 May 2023 09:21:23 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=10125</guid>

					<description><![CDATA[<p>1. What does the &#8216;strict&#8217; pragma do in Perl? a. Enables the use of uninitialized variablesb. Forces variables to be [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/top-50-perl-interview-questions-with-answers/">Top 50 Perl Interview Questions with Answers</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img fetchpriority="high" decoding="async" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2023/05/image-10.png" alt="" class="wp-image-10126" width="637" height="375" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2023/05/image-10.png 815w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2023/05/image-10-300x177.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2023/05/image-10-768x452.png 768w" sizes="(max-width: 637px) 100vw, 637px" /><figcaption class="wp-element-caption"><strong><em>Perl Interview Questions with Answers</em></strong></figcaption></figure>
</div>


<h3 class="wp-block-heading">1. What does the &#8216;strict&#8217; pragma do in Perl?</h3>



<p class="wp-block-paragraph">a. Enables the use of uninitialized variables<br>b. Forces variables to be localized before use<br>c. Requires variables to be declared before use<br>d. Disables the use of regular expressions</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">2. What is the difference between &#8216;my&#8217; and &#8216;local&#8217; in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;my&#8217; creates a global variable, while &#8216;local&#8217; creates a local variable<br>b. &#8216;my&#8217; creates a lexical variable, while &#8216;local&#8217; creates a global variable<br>c. &#8216;my&#8217; creates a private variable, while &#8216;local&#8217; creates a shared variable<br>d. &#8216;my&#8217; creates a static variable, while &#8216;local&#8217; creates a dynamic variable</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">3. Which of the following is not a valid Perl data type?</h3>



<p class="wp-block-paragraph">a. Scalar<br>b. Array<br>c. Object<br>d. Hash</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">4. What is the Perl equivalent of &#8216;if-else&#8217; statement in other programming languages?</h3>



<p class="wp-block-paragraph">a. unless<br>b. when<br>c. elseif<br>d. else</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">5. What is Perl&#8217;s default hash sorting method?</h3>



<p class="wp-block-paragraph">a. Numerically<br>b. Alphabetically<br>c. Randomly<br>d. There is no default sorting method</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">6. What is the purpose of the &#8216;use strict&#8217; pragma in Perl?</h3>



<p class="wp-block-paragraph">a. To disable strict typing<br>b. To enable strict mode<br>c. To enable unsafe features<br>d. To allow undeclared variables</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">7. Which function is used to read input from the standard input in Perl?</h3>



<p class="wp-block-paragraph">a. input()<br>b. read()<br>c. get()<br>d. &lt;&gt;</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">8. What is the difference between &#8216;eq&#8217; and &#8216;==&#8217; in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;eq&#8217; is used for string comparison, while &#8216;==&#8217; is used for numerical comparison<br>b. &#8216;eq&#8217; is used for numerical comparison, while &#8216;==&#8217; is used for string comparison<br>c. Both are used for string comparison<br>d. Both are used for numerical comparison</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">9. What does the &#8216;chomp&#8217; function do in Perl?</h3>



<p class="wp-block-paragraph">a. Removes whitespace at the beginning and end of a string<br>b. Removes a character from the end of a string<br>c. Removes a character from the beginning of a string<br>d. Removes a newline character from the end of a string</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">10. What is the difference between &#8216;open&#8217; and &#8216;close&#8217; functions in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;open&#8217; is used to open a file, while &#8216;close&#8217; is used to close a database connection<br>b. &#8216;open&#8217; is used to create a new file, while &#8216;close&#8217; is used to delete a file<br>c. &#8216;open&#8217; is used to read from a file, while &#8216;close&#8217; is used to write to a file<br>d. &#8216;open&#8217; is used to open a file, while &#8216;close&#8217; is used to close a file</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">11. What is the difference between &#8216;next&#8217; and &#8216;last&#8217; statements in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;next&#8217; moves to the next iteration of a loop, while &#8216;last&#8217; exits the loop<br>b. &#8216;next&#8217; exits the loop, while &#8216;last&#8217; moves to the next iteration of a loop<br>c. Both are used to exit the loop<br>d. Both are used to move to the next iteration of a loop</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">12. What is the Perl equivalent of a switch statement in other programming languages?</h3>



<p class="wp-block-paragraph">a. when<br>b. switch<br>c. case<br>d. if-elsif chain</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">13. What is a Perl reference?</h3>



<p class="wp-block-paragraph">a. A pointer to a memory location<br>b. A scalar value that refers to an array, hash or subroutine<br>c. A value that refers to a file handle<br>d. A reference to a Perl module</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">14. How do you declare a Perl subroutine?</h3>



<p class="wp-block-paragraph">a. function subroutine_name { }<br>b. sub subroutine_name { }<br>c. def subroutine_name { }<br>d. proc subroutine_name { }</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">15. Which symbol is used to dereference a Perl reference?</h3>



<p class="wp-block-paragraph">a. .<br>b. -&gt;<br>c. ::<br>d. #</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">16. What does the expression &#8216;2 x 3&#8217; evaluate to in Perl?</h3>



<p class="wp-block-paragraph">a. 5<br>b. 6<br>c. 8<br>d. 23</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">17. What is the difference between &#8216;+=&#8217;, &#8216;-=&#8217;, &#8216;<em>=&#8217;, &#8216;/=&#8217; and &#8216;%=&#8217; in Perl? </em></h3>



<p class="wp-block-paragraph">a. They are all arithmetic operators<br>b. They are all assignment operators<br>c. &#8216;+=&#8217; adds and assigns the value, &#8216;-=&#8217; subtracts and assigns the value, &#8216;=&#8217; multiplies and assigns the value, &#8216;/=&#8217; divides and assigns the value, &#8216;%=&#8217; modulo and assigns the value<br>d. &#8216;+=&#8217; subtracts and assigns the value, &#8216;-=&#8217; adds and assigns the value, &#8216;*=&#8217; divides and assigns the value, &#8216;/=&#8217; multiplies and assigns the value, &#8216;%=&#8217; adds and assigns the value</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">18. What does the &#8216;split&#8217; function do in Perl?</h3>



<p class="wp-block-paragraph">a. Splits a string into an array of substrings<br>b. Splits an array into a string<br>c. Joins two arrays into a single array<br>d. Joins two strings into a single string</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">19. Which function is used to get the length of a string in Perl?</h3>



<p class="wp-block-paragraph">a. length()<br>b. str_length()<br>c. len()<br>d. count()</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">20. What is the Perl equivalent of a for-in loop in other programming languages?</h3>



<p class="wp-block-paragraph">a. for (my $i=0; $i&lt;=10; $i++) { } </p>



<p class="wp-block-paragraph">b. foreach my $item (@array) { } </p>



<p class="wp-block-paragraph">c. for my $key (keys %hash) { } </p>



<p class="wp-block-paragraph">d. for (my $i=10; $i&gt;=0; $i&#8211;) { }</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">21. Which of the following is not a Perl regular expression metacharacter?</h3>



<p class="wp-block-paragraph">a. *<br>b. +<br>c. $<br>d. ?</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">22. What is the difference between &#8216;reverse&#8217; and &#8216;sort&#8217; functions in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;reverse&#8217; reverses the order of elements in an array, while &#8216;sort&#8217; sorts the elements in ascending order<br>b. &#8216;reverse&#8217; sorts the elements in descending order, while &#8216;sort&#8217; reverses the order of elements in an array<br>c. &#8216;reverse&#8217; reverses the order of elements in an array, while &#8216;sort&#8217; sorts the elements in descending order<br>d. &#8216;reverse&#8217; sorts the elements in ascending order, while &#8216;sort&#8217; reverses the order of elements in an array</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">23. What is the difference between &#8216;print&#8217; and &#8216;printf&#8217; functions in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;print&#8217; displays output on the screen, while &#8216;printf&#8217; writes output to a file<br>b. &#8216;print&#8217; displays output on the screen, while &#8216;printf&#8217; formats output and then displays it on the screen<br>c. &#8216;print&#8217; writes output to a file, while &#8216;printf&#8217; displays output on the screen<br>d. &#8216;print&#8217; formats output and then displays it on the screen, while &#8216;printf&#8217; writes output to a file</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">24. What is the difference between &#8216;eq&#8217; and &#8216;cmp&#8217; in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;eq&#8217; is used for numerical comparison, while &#8216;cmp&#8217; is used for string comparison<br>b. &#8216;eq&#8217; is used for case-sensitive string comparison, while &#8216;cmp&#8217; is used for case-insensitive string comparison<br>c. &#8216;eq&#8217; is used for string comparison, while &#8216;cmp&#8217; is used for numerical comparison<br>d. &#8216;eq&#8217; is used for case-sensitive string comparison, while &#8216;cmp&#8217; is used for case-sensitive string comparison</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">25. What is the difference between &#8216;qw&#8217; and &#8216;q&#8217; in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;qw&#8217; is used to quote a list of words, while &#8216;q&#8217; is used to quote a single string<br>b. &#8216;q&#8217; is used to quote a list of words, while &#8216;qw&#8217; is used to quote a single string<br>c. &#8216;qw&#8217; is used to quote a regular expression, while &#8216;q&#8217; is used to quote a list of words<br>d. &#8216;q&#8217; is used to quote a regular expression, while &#8216;qw&#8217; is used to quote a list of words</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">26. Which function is used to remove an element from an array in Perl?</h3>



<p class="wp-block-paragraph">a. remove()<br>b. delete()<br>c. splice()<br>d. pop()</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">27. What is the Perl equivalent of a while loop in other programming languages?</h3>



<p class="wp-block-paragraph">a. while (condition) { }<br>b. do { } while (condition)<br>c. until (condition) { }<br>d. for (my $i=0; $i&lt;=10; $i++) { }</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">28. What is the difference between &#8216;grep&#8217; and &#8216;map&#8217; functions in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;grep&#8217; filters the elements of an array based on a condition, while &#8216;map&#8217; applies a function to each element of an array<br>b. &#8216;grep&#8217; applies a function to each element of an array, while &#8216;map&#8217; filters the elements of an array based on a condition<br>c. Both functions are used to filter the elements of an array based on a condition<br>d. Both functions are used to apply a function to each element of an array</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">29. What does the &#8216;undef&#8217; function do in Perl?</h3>



<p class="wp-block-paragraph">a. Defines a variable<br>b. Deletes a variable<br>c. Sets a variable to a null value<br>d. Sets a variable to an undefined value</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">30. What is the Perl equivalent of a try-catch block in other programming languages?</h3>



<p class="wp-block-paragraph">a. eval { }, die { }<br>b. try { }, catch { }<br>c. if { }, else { }<br>d. for { }, foreach { }</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">31. What is the difference between &#8216;splice&#8217; and &#8216;slice&#8217; functions in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;splice&#8217; removes elements from an array, while &#8216;slice&#8217; returns a subset of elements from an array<br>b. &#8216;splice&#8217; returns a subset of elements from an array, while &#8216;slice&#8217; removes elements from an array<br>c. Both functions are used to remove elements from an array<br>d. Both functions are used to return a subset of elements from an array</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">32. What is the difference between &#8216;exists&#8217; and &#8216;defined&#8217; functions in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;exists&#8217; checks whether a hash key exists, while &#8216;defined&#8217; checks whether a variable is defined<br>b. &#8216;exists&#8217; checks whether an array element exists, while &#8216;defined&#8217; checks whether a variable is defined<br>c. &#8216;exists&#8217; checks whether a variable is defined, while &#8216;defined&#8217; checks whether a hash key exists<br>d. &#8216;exists&#8217; checks whether a subroutine exists, while &#8216;defined&#8217; checks whether a variable is defined</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">33. Which function is used to concatenate two strings in Perl?</h3>



<p class="wp-block-paragraph">a. concat()<br>b. join()<br>c. merge()<br>d. . (dot)</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">34. Which function is used to replace a pattern in a string with another string in Perl?</h3>



<p class="wp-block-paragraph">a. replace()<br>b. swap()<br>c. substitute()<br>d. s///</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">35. What does the &#8216;do&#8217; block do in Perl?</h3>



<p class="wp-block-paragraph">a. Defines a subroutine<br>b. Runs an external program<br>c. Executes a group of statements<br>d. Imports a module</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">36. What is the Perl equivalent of a ternary operator in other programming languages?</h3>



<p class="wp-block-paragraph">a. if-elsif-else chain<br>b. when-otherwise chain<br>c. either-or chain<br>d. ?:</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">37. What is the Perl equivalent of a do-while loop in other programming languages?</h3>



<p class="wp-block-paragraph">a. while (condition) { }, do { } while (condition)<br>b. do { } until (condition), while (condition) { }<br>c. for (my $i=0; $i&lt;=10; $i++) { }, do { } while (condition)<br>d. until (condition) { }, do { } while (condition)</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">38. What is the Perl equivalent of a continue statement in other programming languages?</h3>



<p class="wp-block-paragraph">a. next<br>b. redo<br>c. last<br>d. continue</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">39. What is the Perl equivalent of a break statement in other programming languages?</h3>



<p class="wp-block-paragraph">a. next<br>b. last<br>c. continue<br>d. break</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">40. Which function is used to convert a string to lowercase or uppercase in Perl?</h3>



<p class="wp-block-paragraph">a. upper()<br>b. lower()<br>c. lc()<br>d. uc()</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">41. Which function is used to get the current time in seconds in Perl?</h3>



<p class="wp-block-paragraph">a. time()<br>b. current_time()<br>c. current_sec()<br>d. clock()</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">42. What does the &#8216;each&#8217; function do in Perl?</h3>



<p class="wp-block-paragraph">a. Returns the number of elements in a hash<br>b. Returns the value of the current hash element<br>c. Returns the key of the current hash element<br>d. Returns the index of the current array element</p>



<h4 class="wp-block-heading">Answer: c</h4>



<h3 class="wp-block-heading">43. What is the difference between &#8216;push&#8217; and &#8216;unshift&#8217; functions in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;push&#8217; adds elements to the end of an array, while &#8216;unshift&#8217; adds elements to the beginning of an array<br>b. &#8216;push&#8217; adds elements to the beginning of an array, while &#8216;unshift&#8217; adds elements to the end of an array<br>c. &#8216;push&#8217; removes elements from the beginning of an array, while &#8216;unshift&#8217; removes elements from the end of an array<br>d. &#8216;push&#8217; removes elements from the end of an array, while &#8216;unshift&#8217; removes elements from the beginning of an array</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">44. What is the difference between &#8216;and&#8217; and &#8216;&amp;&amp;&#8217; operators in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;and&#8217; evaluates both operands, while &#8216;&amp;&amp;&#8217; short-circuits the evaluation if the first operand is false<br>b. &#8216;&amp;&amp;&#8217; evaluates both operands, while &#8216;and&#8217; short-circuits the evaluation if the first operand is false<br>c. Both operators evaluate both operands<br>d. Both operators short-circuit the evaluation if the first operand is false</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">45. What is the difference between &#8216;or&#8217; and &#8216;||&#8217; operators in Perl?</h3>



<p class="wp-block-paragraph">a. &#8216;or&#8217; evaluates both operands, while &#8216;||&#8217; short-circuits the evaluation if the first operand is true<br>b. &#8216;||&#8217; evaluates both operands, while &#8216;or&#8217; short-circuits the evaluation if the first operand is true<br>c. Both operators evaluate both operands<br>d. Both operators short-circuit the evaluation if the first operand is true</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">46. What is the Perl equivalent of a multi-dimensional array in other programming languages?</h3>



<p class="wp-block-paragraph">a. Array of arrays<br>b. Hash of arrays<br>c. Array of hashes<br>d. Hash of hashes</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">47. How do you declare a Perl hash?</h3>



<p class="wp-block-paragraph">a. var %hash = ();<br>b. my %hash = ();<br>c. %hash = ();<br>d. hash = {}</p>



<h4 class="wp-block-heading">Answer: b</h4>



<h3 class="wp-block-heading">48. Which function is used to change the case of the first letter of a string in Perl?</h3>



<p class="wp-block-paragraph">a. ucfirst()<br>b. capitalize()<br>c. upcase()<br>d. firstcap()</p>



<h4 class="wp-block-heading">Answer: a</h4>



<h3 class="wp-block-heading">49. Which function is used to get the size of an array or hash in Perl?</h3>



<p class="wp-block-paragraph">a. length()<br>b. size()<br>c. count()<br>d. scalar()</p>



<h4 class="wp-block-heading">Answer: d</h4>



<h3 class="wp-block-heading">50. Which function is used to pad a string with spaces or other characters in Perl?</h3>



<p class="wp-block-paragraph">a. pad()<br>b. space()<br>c. fill()<br>d. sprintf()</p>



<h4 class="wp-block-heading">Answer: d</h4>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/top-50-perl-interview-questions-with-answers/">Top 50 Perl Interview Questions with Answers</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/top-50-perl-interview-questions-with-answers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Introdcution of Perl</title>
		<link>https://www.scmgalaxy.com/tutorials/introdcution-of-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/introdcution-of-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Mon, 08 Jan 2018 11:03:04 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Introduction of Perl]]></category>
		<category><![CDATA[Perl Introduction]]></category>
		<category><![CDATA[perl language]]></category>
		<category><![CDATA[Perl Overview]]></category>
		<category><![CDATA[why not perl]]></category>
		<category><![CDATA[why perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=4511</guid>

					<description><![CDATA[<p>What is Perl Perl is a programming language, It&#8217;s Object Oriented, simple to learn and very powerful. Perl stand for: [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/introdcution-of-perl/">Introdcution of Perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>What is Perl</strong></p>
<ol>
<li>Perl is a programming language, It&#8217;s Object Oriented, simple to learn and very powerful. Perl stand for: &#8220;Practical Extraction and Reporting Language&#8221;.</li>
<li>Perl is an Interpreted language, so you don&#8217;t have to compile it like you do Java, C, C++ etc. For fast development work, that&#8217;s a godsend.</li>
<li>Perl is a versatile, powerful programming language used in a variety of disciplines, ranging from system administration to web programming to database manipulation.</li>
<li>Perl is a different language to different people. It is a quick scripting tool for some, and a fully-featured object-oriented language for others.</li>
<li>Perl is used in so many places because Perl is a glue language. A glue language is used to bind things together.</li>
<li>Perl is good at is tying these elements together. Perl can take your database, convert it into a spreadsheet-ready file, and, during the processing, fix the data if you want.</li>
<li>Perl can also take your word processing documents and convert them to HTML for display on the Web.</li>
</ol>
<p><strong>WHY PERL.</strong></p>
<p>There are a many reasons why Perl is a great language for use in development and general processing.<br />
Following are some of them…</p>
<ul>
<li><strong>Learning:</strong> Perl has all the same abilities, data constructs and methods of other languages, and its easier to learn then most. If you understand Perl, you will have far less trouble learning other languages like C, C++, Java, PHP etc then if you were starting from scratch.</li>
<li><strong>Interpreted language</strong> means less time spent debugging.</li>
<li><strong>Mod_perl</strong> for CGI work means perl can be as fast as compiled languages without the need to manually compile. mod_perl is an advanced implementation of Perl that runs in the Apache web server. It provides extremely fast performance and full access to Apache internals via Perl.</li>
<li><strong>CPAN.org</strong>, a massive collection of perl modules that can do almost anything, someone has usually done the work for you. CPAN, the Comprehensive Perl Archive Network, is one of the largest repositories of free code in the world. If you need a particular type of functionality, chances are there are several options on the CPAN, and there are no fees or ongoing costs for using it.</li>
<li><strong>Online support</strong>. Perl has been around since the early 90&#8217;s, its exceptionally well known and thousands of tutorial and help sites abound on the internet. Perl has a very strong user community and this is the primary avenue for support.</li>
<li><strong>ISP support.</strong> Perl runs on nearly anything, it comes standard on the vast majority of unix/linux servers and is available free for windows servers. As a result its the most commonly supported language on ISP (Internet Service Providers) hosting servers.</li>
<li><strong>Text processing.</strong> Because perls&#8217; initial reason for living was text processing, its regular expression engine is exceptionally powerful. That means advanced text manipulation is easier then ever. (And let’s face it; nearly all programming is text manipulation of some sort.</li>
<li><strong>Database connectivity.</strong> Thanks to the DBI module, perl can talk to a great many different databases with the same syntax. That means that you only have to learn one interface to talk to over a dozen different database servers. That&#8217;s as opposed to learning each DB&#8217;s syntax and commands seperately. Perl provides an excellent interface to nearly all available databases, along with an abstraction layer that allows you to switch databases without re-writing all of our code.</li>
<li><strong>Freebies.</strong> Since Perl has been around for ages, there are thousands of scripts on the internet that are free to use and/or modify. Perl, Apache, and related technologies are open source and free. On-going overhead cost to vendors for code that continues to run is $0.</li>
<li><strong>Multi-platform:</strong> Perl runs on Linux, MS Windows and all of the platforms listed here: <a href="http://www.cpan.org/ports/" target="_blank" rel="noopener">http://www.cpan.org/ports/</a><img decoding="async" src="denied:denied://file///C%7C/Documents%20and%20Settings/rajkumar/Application%20Data/Adobe/Dreamweaver%209/OfficeImageTemp/clip_image001.gif" alt="external link" width="10" height="10" /></li>
<li><strong>Rich Community Support:</strong> The main point of these stats is that Perl has a large and broad user community. With any technology you choose, you don&#8217;t want to be the only one using it. These numbers show that Perl is still widely used for web development, among other things, and the user community is very active.</li>
</ul>
<ul>
<li><strong>Re-usable code architecture</strong> (modules, OO, etc.): Perl is architected to allow and encourage re-use. The core block of re-use, the module, makes it very easy to leverage business logic across platforms in web applications, batch scripts, and all sorts of integration components.</li>
<li><strong>Multi-use:</strong> Perl can be used to develop Web apps, batch processing, data analysis and text manipulation, command-line utilities and apps, GUI apps.</li>
<li><strong>Multi-language integration:</strong> can interact with C, C++, Java, etc. from within Perl code.</li>
</ul>
<p><strong>WHY NOT PERL.</strong></p>
<p>All languages have areas that they excel in, and others that they don&#8217;t. Perl is no different. Technically, you could write anything in Perl, even a complete operating system. but that does not mean you should. Its a matter of considering your requirements and deciding on the best language to suit them. Here are some reasons why Perl might not be your best choice:</p>
<ul>
<li>Speed. If for example, you were writing a huge word processer like MS Word or WordPerfect. the sheer size of it would make it extremely slow to compile at runtime. For this you would be much better served by a language like C or C++ where the compilation is done before you run it.</li>
</ul>
<p><strong>Reference:</strong></p>
<p><a href="http://www.scmgalaxy.com/component/content/article/64-perl/223-introduction-of-perl.html" rel="nofollow">http://www.scmgalaxy.com/component/content/article/64-perl/223-introduction-of-perl.html</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/introdcution-of-perl/">Introdcution of Perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/introdcution-of-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Perl function to remove any element using value validation</title>
		<link>https://www.scmgalaxy.com/tutorials/perl-function-to-remove-any-element-using-value-validation/</link>
					<comments>https://www.scmgalaxy.com/tutorials/perl-function-to-remove-any-element-using-value-validation/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 10:21:22 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2427</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: perl function to remove any element using value validation perl function to remove any element using [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/perl-function-to-remove-any-element-using-value-validation/">Perl function to remove any element using value validation</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: perl function to remove any element using value validation</strong><br />
perl function to remove any element using value validation</p>
<p>Not Working &#8211;</p>
<p><code>my @items = (rajesh1, rajesh2,rajesh3,rajes4,rajesh5,rajesh7)<br />
my $index = 0;<br />
for my $value (@items) {<br />
print "testing $value\n";<br />
if ( $value == "rajesh1" or $value == "rajesh2" or $value == "rajesh3") {<br />
print "removed value $value\n";<br />
splice @items, $index, 1;<br />
}<br />
$index++;<br />
}<br />
print "@items"</code></p>
<p>Not Working</p>
<p><code>my @items = (rajesh1, rajesh2,rajesh3,rajes4,rajesh5,rajesh7)<br />
my $element_omitted = "rajesh1";<br />
@items = grep { $_ != $element_omitted } @items;<br />
print "Value of @items";</code></p>
<p>Trying this now.</p>
<p><code>my $index = 0;<br />
while ($index <= $#items ) {
my $value = $items[$index];
print "testing $value\n";
if ( $value == 1 or $value == 3 ) {
print "removed value $value\n";
splice @items, $index, 1;
} else {
$index++;
}
}
</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/perl-function-to-remove-any-element-using-value-validation/">Perl function to remove any element using value validation</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/perl-function-to-remove-any-element-using-value-validation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Foreach Vs for Vs while in perl</title>
		<link>https://www.scmgalaxy.com/tutorials/foreach-vs-for-vs-while-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/foreach-vs-for-vs-while-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 10:02:42 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2419</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: foreach Vs for Vs while in perl Definition 1: In the while loop, Perl reads a [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/foreach-vs-for-vs-while-in-perl/">Foreach Vs for Vs while in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: foreach Vs for Vs while in perl</strong></p>
<p>Definition 1:<br />
In the while loop, Perl reads a line of input, puts it into a variable, and runs the body of the loop. Then, it goes back to find another line of input.</p>
<p>But in the foreach loop, the line-input operator is being used in a list context (since foreach needs a list to iterate through). So it has to read all of the input before the loop can start running.</p>
<p>That difference will become apparent when the input is coming from your 400 MB web server logfile! It&#8217;s generally best to use code like the while loop&#8217;s shortcut, which will process input a line at a time, whenever possible. Source-The Llama book</p>
<p>Definition 2:<br />
What Alex Reynolds says in stackoverflow.com<br />
For most purposes, you probably won&#8217;t notice a difference.<br />
However, foreach reads each line into a list (not an array) before going through it line by line, whereas while reads one line at a time.<br />
As foreach will use more memory and require processing time upfront, it is generally recommended to use while to iterate through lines of a file.</p>
<p>In addition to the previous responses, another benefit of using while is that you can use the $. variable. This is the current line number of the last filehandle accessed</p>
<p><code>while ( my $line = <FILE> ) {<br />
    if ( $line =~ /some_target/ ) {<br />
        print "Found some_target at line $.\n";<br />
    }<br />
}</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @<a href="http://twitter.com/RajeshKumarIn"> twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/foreach-vs-for-vs-while-in-perl/">Foreach Vs for Vs while in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/foreach-vs-for-vs-while-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Commonly Used Sign- Punctuation and their Name in Perl</title>
		<link>https://www.scmgalaxy.com/tutorials/commonly-used-sign-punctuation-and-their-name-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/commonly-used-sign-punctuation-and-their-name-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 22 Jul 2014 00:00:00 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Common]]></category>
		<category><![CDATA[Common punctuation marks in Perl]]></category>
		<category><![CDATA[Commonly Used]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[Marks]]></category>
		<category><![CDATA[Name]]></category>
		<category><![CDATA[Perl Common Sign- Punctuation marks]]></category>
		<category><![CDATA[Perl Sign- Punctuation Guide]]></category>
		<category><![CDATA[Perl Sign- Punctuation List]]></category>
		<category><![CDATA[Perl Sign- Punctuation marks]]></category>
		<category><![CDATA[Perl Sign- Punctuation Reference]]></category>
		<category><![CDATA[Punctuation]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Sign]]></category>
		<category><![CDATA[Sign Punctuation]]></category>
		<category><![CDATA[Use]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2014/07/22/commonly-used-sign-punctuation-and-their-name-in-perl/</guid>

					<description><![CDATA[<p>Commonly Used Sign- Punctuation and their Name in Perl ( =&#62; ) Comma Arrow  ( ‘ ’, “ ”, &#8216; &#8216;, &#8221; &#8220; ) [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/commonly-used-sign-punctuation-and-their-name-in-perl/">Commonly Used Sign- Punctuation and their Name in Perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p align="center"><img decoding="async" class="alignnone size-full wp-image-3658" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2014/07/sign-punctuation-name-in-pe-1.png" alt="perl-sign-punctuation-marks" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2014/07/sign-punctuation-name-in-pe-1.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2014/07/sign-punctuation-name-in-pe-1-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p style="text-align: left;" align="center"><strong><span style="text-decoration: underline;">Commonly Used Sign-</span></strong> <strong><span style="text-decoration: underline;">Punctuation and their Name in Perl </span></strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="319">( =&gt; ) Comma Arrow</td>
<td valign="top" width="319"> ( <strong>‘ ’</strong>, <strong>“ ”</strong>, <strong>&#8216; &#8216;</strong>, <strong>&#8221; &#8220;</strong> ) à Quotation marks</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>$</strong> ) àDollar sign</td>
<td valign="top" width="319">( <strong>~ </strong>) à Tilde</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>%</strong> ) àPercent sign</td>
<td valign="top" width="319">(  <strong>,</strong>  ) à Comma</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>@</strong> ) à At Sign</td>
<td valign="top" width="319">( <strong>;</strong> ) à Semicolon</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>&amp;</strong> ) à Ampersand Sign</td>
<td valign="top" width="319">( <strong>:</strong> ) à Colon</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>/</strong> ) à Forward Slash/Slash sign</td>
<td valign="top" width="319">( <strong>‒</strong>, <strong>–</strong>, <strong>—</strong> ) à Dash</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>\</strong> )  à Backslash/Slash Sign</td>
<td valign="top" width="319">( <strong>&#8211;</strong> )    à Hyphen-minus</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>&lt;</strong> )  à Less than Sign</td>
<td valign="top" width="319">( <strong>_</strong> ) àunderscore</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>&gt;</strong> )  à Greater than sign</td>
<td valign="top" width="319">( <strong>/</strong>,  <strong>⁄ </strong> ) à slash/stroke/solidus</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>{ }</strong> )  àCurly Braces</td>
<td valign="top" width="319">( <strong>* </strong>) à Asterisk</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>[  ]</strong> ) à Square brackets</td>
<td valign="top" width="319">( <strong>^</strong> ) à caret</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>( )</strong> )  à Round brackets</td>
<td valign="top" width="319">( <strong>¦</strong>, <strong>|</strong> ) à vertical bar/broken bar/pipe</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>′</strong>, <strong>″</strong>, <strong>‴ </strong>) àprime</td>
<td valign="top" width="319">( <strong>〃</strong> ) à Ditto mark</td>
</tr>
<tr>
<td valign="top" width="319">( <strong>!</strong> ) à Exclamation Mark</td>
<td valign="top" width="319">( <strong>?</strong> ) &#8211; Question Mark</td>
</tr>
</tbody>
</table>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/commonly-used-sign-punctuation-and-their-name-in-perl/">Commonly Used Sign- Punctuation and their Name in Perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/commonly-used-sign-punctuation-and-their-name-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Execute external commands by using perl?</title>
		<link>https://www.scmgalaxy.com/tutorials/executing-external-commands-using-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/executing-external-commands-using-perl/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 04 May 2012 11:02:25 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[Execute]]></category>
		<category><![CDATA[Execute external commands]]></category>
		<category><![CDATA[Execute external commands from Perl]]></category>
		<category><![CDATA[External]]></category>
		<category><![CDATA[External commands]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[Implement]]></category>
		<category><![CDATA[Implement external commands by using perl]]></category>
		<category><![CDATA[Perl Guide for executing external commands]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Using]]></category>
		<category><![CDATA[Ways]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2012/05/04/executing-external-commands-using-perl/</guid>

					<description><![CDATA[<p>There are many ways to execute external commands from Perl. The most commons are: system function exec function backticks (&#8220;) [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/executing-external-commands-using-perl/">How to Execute external commands by using perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3828 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/05/external-commands-using-per.png" alt="execute-external-commands-from-perl" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/05/external-commands-using-per.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/05/external-commands-using-per-300x200.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<p>There are many ways to execute external commands from Perl. The most commons are:</p>
<ul type="disc">
<li><strong>system</strong> function</li>
<li><strong>exec</strong> function</li>
<li><strong>backticks (&#8220;)</strong> operator</li>
<li><strong>open</strong> function</li>
</ul>
<p>All of these methods have different behaviour, so you should choose which one to use depending of your particular need. In brief, these are the recommendations:</p>
<table border="1" cellpadding="0">
<tbody>
<tr>
<td><strong>method</strong></td>
<td><strong>use if &#8230;</strong></td>
</tr>
<tr>
<td>system()</td>
<td>you want to execute a command and don&#8217;t want to capture its output</td>
</tr>
<tr>
<td>exec</td>
<td>you don&#8217;t want to return to the calling perl script</td>
</tr>
<tr>
<td>backticks</td>
<td>you want to capture the output of the command</td>
</tr>
<tr>
<td>open</td>
<td>you want to pipe the command (as input or output) to your script</td>
</tr>
</tbody>
</table>
<p>More detailed explanations of each method follows:</p>
<p><strong>Using system() </strong><br />
system() executes the command specified. It doesn&#8217;t capture the output of the command.<br />
system() accepts as argument either a scalar or an array. If the argument is a scalar, system() uses a shell to execute the command (&#8220;/bin/sh -c command&#8221;); if the argument is an array it executes the command directly, considering the first element of the array as the command name and the remaining array elements as arguments to the command to be executed.<br />
For that reason, it&#8217;s highly recommended for efficiency and safety reasons (specially if you&#8217;re running a cgi script) that you use an array to pass arguments to system()</p>
<pre><strong>Example: </strong>     #-- calling 'command' with  arguments    system("command arg1 arg2 arg3");         #-- better way of calling the same command    system("command", "arg1", "arg2",  "arg3");     The return value  is set in <strong>$?</strong>; this value is the exit status of the command as returned  by the 'wait' call; to get the real exit status of the command you have to  shift right by 8 the value of $? ($? &gt;&gt; 8).     If the value of <strong>$?</strong> is -1, then the command failed to execute, in that case you may check the value  of <strong>$!</strong> for the reason of the failure.</pre>
<pre><strong>Example: </strong>     system("command",  "arg1");    if ( $? == -1 )    {      print "command failed: $!\n";    }    else    {      printf "command exited with value %d", $? &gt;&gt; 8;    }</pre>
<p><strong>Using exec() </strong><br />
The exec() function executes the command specified and never returns to the calling program, except in the case of failure because the specified command does not exist AND the exec argument is an array.<br />
Like in system(), is recommended to pass the arguments of the functions as an array.</p>
<p><strong>Using backticks (&#8220;) </strong><br />
In this case the command to be executed is surrounded by backticks. The command is executed and the output of the command is returned to the calling script.<br />
In scalar context it returns a single (possibly multiline) string, in list context it returns a list of lines or an empty list if the command failed.<br />
The exit status of the executed command is stored in <strong>$?</strong> (see system() above for details).</p>
<pre><strong>Example: </strong>     #-- scalar context    $result = `command arg1 arg2`;         #-- the same command in list context    @result = `command arg2 arg2`;     Notice that the  only output captured is STDOUT, to collect messages sent to STDERR you should  redirect STDERR to STDOUT</pre>
<pre><strong>Example: </strong>     #-- capture STDERR as well  as STDOUT    $result = `command 2&gt;&amp;1`;</pre>
<p><strong>Using open() </strong><br />
Use open() when you want to:<br />
&#8211; capture the data of a command (syntax: open(&#8220;command |&#8221;))<br />
&#8211; feed an external command with data generated from the Perl script (syntax: open(&#8220;| command&#8221;))</p>
<pre><strong>Examples: </strong>     #-- list the processes  running on your system    open(PS,"ps -e -o pid,stime,args |") || die "Failed: $!\n";    while ( &lt;PS&gt; )    {      #-- do something here    }         #-- send an email to user@localhost    open(MAIL, "| /bin/mailx -s test user\@localhost ") || die  "mailx failed: $!\n";  print MAIL "This is a test message";</pre>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/executing-external-commands-using-perl/">How to Execute external commands by using perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/executing-external-commands-using-perl/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Difference between use and require in Perl &#8211; use Vs require in perl</title>
		<link>https://www.scmgalaxy.com/tutorials/difference-between-use-and-require-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/difference-between-use-and-require-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Thu, 05 Apr 2012 11:41:21 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Perl Guide]]></category>
		<category><![CDATA[Perl Tutorial]]></category>
		<category><![CDATA[Perl use and require Difference]]></category>
		<category><![CDATA[Require]]></category>
		<category><![CDATA[Use]]></category>
		<category><![CDATA[use and require Difference in Perl]]></category>
		<category><![CDATA[use Vs require in perl]]></category>
		<category><![CDATA[What]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2012/04/05/difference-between-use-and-require-in-perl/</guid>

					<description><![CDATA[<p>&#124;&#124; use Vs require in perl &#124;&#124; What is the difference between use and require? Except of course that use [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/difference-between-use-and-require-in-perl/">Difference between use and require in Perl &#8211; use Vs require in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3846 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/04/perl-use-require-difference.png" alt="perl-use-require-difference" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/04/perl-use-require-difference.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/04/perl-use-require-difference-300x200.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<p><strong>|| use Vs require in perl || What is the difference between use and require?</strong></p>
<p>Except of course that use is evaluated at compile time where as require is evaluated at run time in other word, A use anywhere in the code will be evaluated when the code is run compiled, but require &#8211; import&#8217;s can only get evaluated when encoutered.</p>
<p><strong>The differences are many and often subtle:</strong></p>
<ol>
<li>use only expects a bareword, require can take a bareword or an expression</li>
<li>use is evaluated at compile-time, require at run-time</li>
<li>use implicitly calls the import method of the module being loaded, require does not</li>
<li>use excepts arguments in addition to the bareword (to be passed to import), require does not</li>
<li>use does not behave like a function (i.e can&#8217;t be called with parens, can&#8217;t be used in an expression, etc), whereas require does</li>
</ol>
<p>do $file is like eval `cat $file`, except the former:<br />
1.1: searches @INC and updates %INC.<br />
1.2: bequeaths an *unrelated* lexical scope on the eval&#8217;ed code.</p>
<p><strong>require $file is like do $file, except the former:</strong><br />
2.1: checks for redundant loading, skipping already loaded files.<br />
2.2: raises an exception on failure to find, compile, or execute $file.</p>
<p><strong>require Module is like require &#8220;Module.pm&#8221;, except the former:</strong><br />
3.1: translates each &#8220;::&#8221; into your system&#8217;s directory separator.<br />
3.2: primes the parser to disambiguate class Module as an indirect object.</p>
<p><strong>use Module is like require Module, except the former:</strong><br />
4.1: loads the module at compile time, not run-time.<br />
4.2: imports symbols and semantics from that package to the current one.</p>
<p><strong>Command to learn more about use and require</strong><br />
&gt; perldoc -f require<br />
&gt; perldoc -f use</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/difference-between-use-and-require-in-perl/">Difference between use and require in Perl &#8211; use Vs require in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/difference-between-use-and-require-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Check  File Attributes in Perl ? Perl File Attributes explained</title>
		<link>https://www.scmgalaxy.com/tutorials/checking-file-attributes-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/checking-file-attributes-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 22 Nov 2011 14:14:25 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Check]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[File Attributes]]></category>
		<category><![CDATA[File Attributes in Perl]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[Perl attributes]]></category>
		<category><![CDATA[Perl attributes explained]]></category>
		<category><![CDATA[Perl attributes tutorial]]></category>
		<category><![CDATA[Perl File Attributes explained]]></category>
		<category><![CDATA[Perl File Attributes Guide]]></category>
		<category><![CDATA[Perl File Attributes Reference]]></category>
		<category><![CDATA[Perl Tutorial]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2011/11/22/checking-file-attributes-in-perl/</guid>

					<description><![CDATA[<p>Checking File Attributes in Perl I have been using perl for quite some time now. I have also been using the [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/checking-file-attributes-in-perl/">How to Check  File Attributes in Perl ? Perl File Attributes explained</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3879 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2011/11/file-attributes-in-perl.png" alt="perl-file-attributes" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2011/11/file-attributes-in-perl.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2011/11/file-attributes-in-perl-300x200.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></h2>
<h2>Checking File Attributes in Perl</h2>
<p>I have been using perl for quite some time now. I have also been using the file handling logic in my scripts. However, what I did not know till now is that you can quickly check for certain file properties in perl. Here is an example:<br />
#!/usr/bin/perl<br />
my (@description,$size);<br />
if (-e $file)<br />
{<br />
push @description, ‘binary’ if (-B _);<br />
push @description, ‘a socket’ if (-S _);<br />
push @description, ‘a text file’ if (-T _);<br />
push @description, ‘a block special file’ if (-b _);<br />
push @description, ‘a character special file’ if (-c _);<br />
push @description, ‘a directory’ if (-d _);<br />
push @description, ‘executable’ if (-x _);<br />
push @description, (($size = -s _)) ? “$size bytes” : ‘empty’;<br />
print “$file is “, join(‘, ‘,@description),”\n”;<br />
}<br />
Nice, isn’t it?<br />
Here is the complete list of features that you can check:</p>
<table border="1" width="445" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="155"><strong>Operator </strong></td>
<td valign="top" width="435"><strong>Description</strong></td>
</tr>
<tr>
<td valign="top" width="155">-A</td>
<td valign="top" width="435">Age of file (at script startup) in days since modification.</td>
</tr>
<tr>
<td valign="top" width="155">-B</td>
<td valign="top" width="435">Is it a binary file?</td>
</tr>
<tr>
<td valign="top" width="155">-C</td>
<td valign="top" width="435">Age of file (at script startup) in days since modification.</td>
</tr>
<tr>
<td valign="top" width="155">-M</td>
<td valign="top" width="435">Age of file (at script startup) in days since modification.</td>
</tr>
<tr>
<td valign="top" width="155">-O</td>
<td valign="top" width="435">Is the file owned by the real user ID?</td>
</tr>
<tr>
<td valign="top" width="155">-R</td>
<td valign="top" width="435">Is the file readable by the real user ID or real group?</td>
</tr>
<tr>
<td valign="top" width="155">-S</td>
<td valign="top" width="435">Is the file a socket?</td>
</tr>
<tr>
<td valign="top" width="155">-T</td>
<td valign="top" width="435">Is it a text file?</td>
</tr>
<tr>
<td valign="top" width="155">-W</td>
<td valign="top" width="435">Is the file writable by the real user ID or real group?</td>
</tr>
<tr>
<td valign="top" width="155">-X</td>
<td valign="top" width="435">Is the file executable by the real user ID or real group?</td>
</tr>
<tr>
<td valign="top" width="155">-b</td>
<td valign="top" width="435">Is it a block special file?</td>
</tr>
<tr>
<td valign="top" width="155">-c</td>
<td valign="top" width="435">Is it a character special file?</td>
</tr>
<tr>
<td valign="top" width="155">-d</td>
<td valign="top" width="435">Is the file a directory?</td>
</tr>
<tr>
<td valign="top" width="155">-e</td>
<td valign="top" width="435">Does the file exist?</td>
</tr>
<tr>
<td valign="top" width="155">-f</td>
<td valign="top" width="435">Is it a plain file?</td>
</tr>
<tr>
<td valign="top" width="155">-g</td>
<td valign="top" width="435">Does the file have the setgid bit set?</td>
</tr>
<tr>
<td valign="top" width="155">-k</td>
<td valign="top" width="435">Does the file have the sticky bit set?</td>
</tr>
<tr>
<td valign="top" width="155">-l</td>
<td valign="top" width="435">Is the file a symbolic link?</td>
</tr>
<tr>
<td valign="top" width="155">-o</td>
<td valign="top" width="435">Is the file owned by the effective user ID?</td>
</tr>
<tr>
<td valign="top" width="155">-p</td>
<td valign="top" width="435">Is the file a named pipe?</td>
</tr>
<tr>
<td valign="top" width="155">-r</td>
<td valign="top" width="435">Is the file readable by the effective user or group ID?</td>
</tr>
<tr>
<td valign="top" width="155">-s</td>
<td valign="top" width="435">Returns the size of the file, zero size = empty file.</td>
</tr>
<tr>
<td valign="top" width="155">-t</td>
<td valign="top" width="435">Is the filehandle opened by a TTY (terminal)?</td>
</tr>
<tr>
<td valign="top" width="155">-u</td>
<td valign="top" width="435">Does the file have the setuid bit set?</td>
</tr>
<tr>
<td valign="top" width="155">-w</td>
<td valign="top" width="435">Is the file writable by the effective user or group ID?</td>
</tr>
<tr>
<td valign="top" width="155">-x</td>
<td valign="top" width="435">Is the file executable by the effective user or group ID?</td>
</tr>
<tr>
<td valign="top" width="155">-z</td>
<td valign="top" width="435">Is the file size zero?</td>
</tr>
</tbody>
</table>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/checking-file-attributes-in-perl/">How to Check  File Attributes in Perl ? Perl File Attributes explained</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/checking-file-attributes-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Introduction of Perl &#8211; Complete Overview</title>
		<link>https://www.scmgalaxy.com/tutorials/introduction-of-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/introduction-of-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Mon, 26 Apr 2010 11:49:06 +0000</pubDate>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[About Perl]]></category>
		<category><![CDATA[Diadvantages of Perl]]></category>
		<category><![CDATA[Importance of perl]]></category>
		<category><![CDATA[Introduction of Perl]]></category>
		<category><![CDATA[Perl Guide]]></category>
		<category><![CDATA[Perl Introduction]]></category>
		<category><![CDATA[Perl Overview]]></category>
		<category><![CDATA[Perl Programming Language]]></category>
		<category><![CDATA[Perl Programming Language Complete guide]]></category>
		<category><![CDATA[Strengths and weaknesses of perl]]></category>
		<category><![CDATA[What is Perl]]></category>
		<category><![CDATA[Why to use perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2010/04/26/introduction-of-perl/</guid>

					<description><![CDATA[<p>What is Perl Perl is a programming language, It&#8217;s Object Oriented, simple to learn and very powerful. Perl stand for: [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/introduction-of-perl/">Introduction of Perl &#8211; Complete Overview</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4331 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/04/perl-intro.png" alt="perl-introduction" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/04/perl-intro.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/04/perl-intro-300x200.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<p><b>What is Perl</b></p>
<ol>
<li>Perl is a programming language, It&#8217;s Object Oriented, simple to learn and very powerful. Perl stand for: &#8220;Practical Extraction and Reporting Language&#8221;.</li>
<li>Perl is an Interpreted language, so you don&#8217;t have to compile it like you do Java, C, C++ etc. For fast development work, that&#8217;s a godsend.</li>
<li>Perl is a versatile, powerful programming language used in a variety of disciplines, ranging from system administration to web programming to database manipulation.</li>
<li>Perl is a different language to different people. It is a quick scripting tool for some, and a fully-featured object-oriented language for others.</li>
<li>Perl is used in so many places because Perl is a glue language. A glue language is used to bind things together.</li>
<li>Perl is good at is tying these elements together. Perl can take your database, convert it into a spreadsheet-ready file, and, during the processing, fix the data if you want.</li>
<li>Perl can also take your word processing documents and convert them to HTML for display on the Web.</li>
</ol>
<p><b>WHY PERL.</b></p>
<p>There are a many reasons why Perl is a great language for use in development and general processing.<br />
Following are some of them…</p>
<ul type="disc">
<li><b>Learning:</b> Perl has all the same abilities, data constructs and methods of other languages, and its easier to learn then most. If you understand Perl, you will have far less trouble learning other languages like C, C++, Java, PHP etc then if you were starting from scratch.</li>
<li><b>Interpreted language</b> means less time spent debugging.</li>
<li><b>Mod_perl</b> for CGI work means perl can be as fast as compiled languages without the need to manually compile. mod_perl is an advanced implementation of Perl that runs in the Apache web server. It provides extremely fast performance and full access to Apache internals via Perl.</li>
<li><b>CPAN.org</b>, a massive collection of perl modules that can do almost anything, someone has usually done the work for you. CPAN, the Comprehensive Perl Archive Network, is one of the largest repositories of free code in the world. If you need a particular type of functionality, chances are there are several options on the CPAN, and there are no fees or ongoing costs for using it.</li>
<li><b>Online support</b>. Perl has been around since the early 90&#8217;s, its exceptionally well known and thousands of tutorial and help sites abound on the internet. Perl has a very strong user community and this is the primary avenue for support.</li>
<li><b>ISP support.</b> Perl runs on nearly anything, it comes standard on the vast majority of unix/linux servers and is available free for windows servers. As a result its the most commonly supported language on ISP (Internet Service Providers) hosting servers.</li>
<li><b>Text processing.</b> Because perls&#8217; initial reason for living was text processing, its regular expression engine is exceptionally powerful. That means advanced text manipulation is easier then ever. (And let’s face it; nearly all programming is text manipulation of some sort.</li>
<li><b>Database connectivity.</b> Thanks to the DBI module, perl can talk to a great many different databases with the same syntax. That means that you only have to learn one interface to talk to over a dozen different database servers. That&#8217;s as opposed to learning each DB&#8217;s syntax and commands seperately. Perl provides an excellent interface to nearly all available databases, along with an abstraction layer that allows you to switch databases without re-writing all of our code.</li>
<li><b>Freebies.</b> Since Perl has been around for ages, there are thousands of scripts on the internet that are free to use and/or modify. Perl, Apache, and related technologies are open source and free. On-going overhead cost to vendors for code that continues to run is $0.</li>
<li><b>Multi-platform:</b> Perl runs on Linux, MS Windows and all of the platforms listed here: <a href="http://www.cpan.org/ports/" target="_blank" rel="noopener">http://www.cpan.org/ports/</a><img loading="lazy" decoding="async" class=" size-full wp-image-247" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/04/clip_image001.gif" alt="external link" width="10" height="10" border="0" /></li>
<li><b>Rich Community Support:</b> The main point of these stats is that Perl has a large and broad user community. With any technology you choose, you don&#8217;t want to be the only one using it. These numbers show that Perl is still widely used for web development, among other things, and the user community is very active.</li>
</ul>
<ul type="disc">
<li><b>Re-usable code architecture</b> (modules, OO, etc.): Perl is architected to allow and encourage re-use. The core block of re-use, the module, makes it very easy to leverage business logic across platforms in web applications, batch scripts, and all sorts of integration components.</li>
<li><b>Multi-use:</b> Perl can be used to develop Web apps, batch processing, data analysis and text manipulation, command-line utilities and apps, GUI apps.</li>
<li><b>Multi-language integration:</b> can interact with C, C++, Java, etc. from within Perl code.</li>
</ul>
<p><b>WHY NOT PERL.</b></p>
<p>All languages have areas that they excel in, and others that they don&#8217;t. Perl is no different. Technically, you could write anything in Perl, even a complete operating system. but that does not mean you should. Its a matter of considering your requirements and deciding on the best language to suit them. Here are some reasons why Perl might not be your best choice:</p>
<ul type="disc">
<li>Speed. If for example, you were writing a huge word processer like MS Word or WordPerfect. the sheer size of it would make it extremely slow to compile at runtime. For this you would be much better served by a language like C or C++ where the compilation is done before you run it.</li>
</ul>
<p>&nbsp;</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/introduction-of-perl/">Introduction of Perl &#8211; Complete Overview</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/introduction-of-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
