<?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 Tutorial Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/perl-tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/perl-tutorial/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:52:56 +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>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 fetchpriority="high" 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="(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 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="(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>
	</channel>
</rss>
