<?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>Linux Ask! &#187; Perl</title>
	<atom:link href="http://www.linuxask.com/topics/programming/perl/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxask.com</link>
	<description>Linux Ask! is a Q &#38; A web site specific for Linux related questions such as how to use common Linux commands.</description>
	<lastBuildDate>Tue, 05 May 2015 07:15:40 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>Use Perl to split string instead of awk</title>
		<link>http://www.linuxask.com/questions/use-perl-to-split-string-instead-of-awk</link>
		<comments>http://www.linuxask.com/questions/use-perl-to-split-string-instead-of-awk#comments</comments>
		<pubDate>Thu, 29 May 2014 08:04:28 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Advanced Linux]]></category>
		<category><![CDATA[Commands]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=4402</guid>
		<description><![CDATA[Use Perl to split string instead of awk Answer: If you know Perl well, there is no need to use awk to do string processing such as string splitting, it is easy with Perl also, e.g. # echo "foo,bar,k3" &#124; perl -F',' -lane 'print $F[1]' bar<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/split-a-string-into-array-in-perl" rel="bookmark" title="Split a string into array in Perl">Split a string into array in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/trim-a-string-using-perl" rel="bookmark" title="Trim a string using Perl">Trim a string using Perl </a></li>
<li><a href="http://www.linuxask.com/questions/remove-the-last-character-of-a-string-in-perl" rel="bookmark" title="Remove the last character of a string in Perl">Remove the last character of a string in Perl </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Use Perl to split string instead of awk</p>
<p><strong>Answer:</strong></p>
<p>If you know Perl well, there is no need to use awk to do string processing such as string splitting, it is easy with Perl also, e.g.</p>
<pre><code># echo "foo,bar,k3"  | perl -F',' -lane 'print $F[1]'
bar
</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/split-a-string-into-array-in-perl" rel="bookmark" title="Split a string into array in Perl">Split a string into array in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/trim-a-string-using-perl" rel="bookmark" title="Trim a string using Perl">Trim a string using Perl </a></li>
<li><a href="http://www.linuxask.com/questions/remove-the-last-character-of-a-string-in-perl" rel="bookmark" title="Remove the last character of a string in Perl">Remove the last character of a string in Perl </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/use-perl-to-split-string-instead-of-awk/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World in different scripting languages</title>
		<link>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages</link>
		<comments>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages#comments</comments>
		<pubDate>Wed, 28 Sep 2011 10:44:11 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3528</guid>
		<description><![CDATA[Print to standard output in different scripting languages Answer: To print a string of "Hello World" to the standard output in different scripting languages 1. Perl print "Hello, World!"; 2. Python print('Hello, World!') 3. PHP echo "Hello, World!"; 4. Ruby puts "Hello, World!"<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-ruby" rel="bookmark" title="Multi-line string in Ruby">Multi-line string in Ruby </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-perform-syntax-check-for-python-program" rel="bookmark" title="How to perform syntax check for Python program">How to perform syntax check for Python program </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-modify-a-single-character-in-a-string-in-python" rel="bookmark" title="How to modify a single character in a string in Python?">How to modify a single character in a string in Python? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Print to standard output in different scripting languages</p>
<p><strong>Answer:</strong></p>
<p>To print a string of "<strong>Hello World</strong>" to the standard output in different scripting languages</p>
<p><strong>1. Perl<br />
</strong><br />
<code>print "Hello, World!";</code></p>
<p><strong>2. Python<br />
</strong><br />
<code>print('Hello, World!')</code></p>
<p><strong>3. PHP<br />
</strong><br />
<code>echo "Hello, World!";</code></p>
<p><strong>4. Ruby<br />
</strong><br />
<code>puts "Hello, World!"</code></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-ruby" rel="bookmark" title="Multi-line string in Ruby">Multi-line string in Ruby </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-perform-syntax-check-for-python-program" rel="bookmark" title="How to perform syntax check for Python program">How to perform syntax check for Python program </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-modify-a-single-character-in-a-string-in-python" rel="bookmark" title="How to modify a single character in a string in Python?">How to modify a single character in a string in Python? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Perl strict mode to restrict unsafe constructs</title>
		<link>http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs</link>
		<comments>http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs#comments</comments>
		<pubDate>Mon, 26 Sep 2011 10:33:56 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3524</guid>
		<description><![CDATA[Enable Perl strict mode to restrict unsafe constructs Answer: In Perl, you can enforce using the strict mode to reduce the chance of nasty error, e.g. $foo = 'bar'; print $foo; If you run the above problem, it is completely valid. # perl test.pl bar However, if you use the strict pragma use strict; $foo <a href='http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/read-command-line-arguments-in-perl" rel="bookmark" title="Read command line arguments in Perl">Read command line arguments in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/force-perl-to-use-integer-arithmetic" rel="bookmark" title="Force Perl to use integer arithmetic">Force Perl to use integer arithmetic </a></li>
<li><a href="http://www.linuxask.com/questions/run-perl-with-useful-warnings" rel="bookmark" title="Run Perl with useful warnings">Run Perl with useful warnings </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Enable Perl strict mode to restrict unsafe constructs</p>
<p><strong>Answer:</strong></p>
<p>In <strong>Perl</strong>, you can enforce using the <strong>strict </strong>mode to reduce the chance of nasty error, e.g.</p>
<pre><code>$foo = 'bar';
print $foo;</code></pre>
<p>If you run the above problem, it is completely valid.</p>
<pre><code># perl test.pl
bar
</code></pre>
<p>However, if you use the <strong>strict </strong>pragma</p>
<pre><code>use strict;

$foo = 'bar';
print $foo;</code></pre>
<p>And run the program again..</p>
<pre><code># perl test.pl
Global symbol "$foo" requires explicit package name at test.pl line 3.
Global symbol "$foo" requires explicit package name at test.pl line 4.
Execution of test.pl aborted due to compilation errors.</code></pre>
<p>Since the <strong>$foo</strong> is not declared before the first use, so the compilation stopped. In modern Perl developements, it is recommended to alwasys use the <strong>strict </strong>pragma in order to write a better and maintainable program.</p>
<p>To fix the problem, you need to use the <strong>my</strong> keyword, e.g.</p>
<pre><code>use strict;

my $foo = 'bar';
print $foo;</code></pre>
<p>And run the program again. (Thanks Jeroen for the suggestion)</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/read-command-line-arguments-in-perl" rel="bookmark" title="Read command line arguments in Perl">Read command line arguments in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/force-perl-to-use-integer-arithmetic" rel="bookmark" title="Force Perl to use integer arithmetic">Force Perl to use integer arithmetic </a></li>
<li><a href="http://www.linuxask.com/questions/run-perl-with-useful-warnings" rel="bookmark" title="Run Perl with useful warnings">Run Perl with useful warnings </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Multi-line string in Perl</title>
		<link>http://www.linuxask.com/questions/multi-line-string-in-perl</link>
		<comments>http://www.linuxask.com/questions/multi-line-string-in-perl#comments</comments>
		<pubDate>Sun, 02 Jan 2011 03:39:34 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2122</guid>
		<description><![CDATA[Multi-line string in Perl Answer: To assign a multi-line string to a variable in Perl, is easy with the following trick: my $html = &#60;&#60;END; &#60;p&#62; This is HTML content. &#60;/p&#62; END print $html;<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-php" rel="bookmark" title="Multi-line string in PHP">Multi-line string in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-ruby" rel="bookmark" title="Multi-line string in Ruby">Multi-line string in Ruby </a></li>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-python" rel="bookmark" title="Multi-line string in Python">Multi-line string in Python </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Multi-line string in Perl</p>
<p><strong>Answer:</strong></p>
<p>To assign a multi-line string to a variable in Perl, is easy with the following trick:</p>
<pre><code>my $html = &lt;&lt;END;
&lt;p&gt;
    This is HTML content.
&lt;/p&gt;

END

print $html;
</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-php" rel="bookmark" title="Multi-line string in PHP">Multi-line string in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-ruby" rel="bookmark" title="Multi-line string in Ruby">Multi-line string in Ruby </a></li>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-python" rel="bookmark" title="Multi-line string in Python">Multi-line string in Python </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/multi-line-string-in-perl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can I find out my current package in Perl?</title>
		<link>http://www.linuxask.com/questions/how-can-i-find-out-my-current-package-in-perl</link>
		<comments>http://www.linuxask.com/questions/how-can-i-find-out-my-current-package-in-perl#comments</comments>
		<pubDate>Tue, 21 Dec 2010 14:48:58 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2228</guid>
		<description><![CDATA[How can I find out my current package in Perl? Answer: To find the current package in your Perl script, you can try something like the following: package Foo; my $current_package = __PACKAGE__; print "I am in package $current_package\n"; 1; When executed: # perl foo.pl I am in package Foo<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/how-to-print-the-current-stack-backtrace-in-perl" rel="bookmark" title="How to print the current stack backtrace in Perl?">How to print the current stack backtrace in Perl? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-find-a-perl-modules-path" rel="bookmark" title="How to find a Perl Module&#8217;s Path">How to find a Perl Module&#8217;s Path </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-find-out-whether-reference-is-pointing-to-a-scalar-array-or-hash-in-perl" rel="bookmark" title="How to find out whether reference is pointing to a scalar, array or hash in Perl?">How to find out whether reference is pointing to a scalar, array or hash in Perl? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>How can I find out my current package in Perl?</p>
<p><strong>Answer:</strong></p>
<p>To find the current package in your Perl script, you can try something like the following:</p>
<pre><code>package Foo;

my $current_package = __PACKAGE__;
print "I am in package $current_package\n";

1;</code></pre>
<p>When executed:</p>
<pre><code># perl foo.pl

I am in package Foo</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/how-to-print-the-current-stack-backtrace-in-perl" rel="bookmark" title="How to print the current stack backtrace in Perl?">How to print the current stack backtrace in Perl? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-find-a-perl-modules-path" rel="bookmark" title="How to find a Perl Module&#8217;s Path">How to find a Perl Module&#8217;s Path </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-find-out-whether-reference-is-pointing-to-a-scalar-array-or-hash-in-perl" rel="bookmark" title="How to find out whether reference is pointing to a scalar, array or hash in Perl?">How to find out whether reference is pointing to a scalar, array or hash in Perl? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-can-i-find-out-my-current-package-in-perl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can I comment out a large block of Perl code?</title>
		<link>http://www.linuxask.com/questions/how-can-i-comment-out-a-large-block-of-perl-code</link>
		<comments>http://www.linuxask.com/questions/how-can-i-comment-out-a-large-block-of-perl-code#comments</comments>
		<pubDate>Mon, 20 Dec 2010 07:47:03 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2680</guid>
		<description><![CDATA[How can I comment out a large block of Perl code? Answer: Perl does not support multi-line comments like C++ or Java. If you want to comment out a large block of Perl code, there is still a trick. package Foo; =pod This is a multi-line comments more... more... =cut print "Hello";<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/how-to-comment-out-a-large-block-of-lines-in-vi" rel="bookmark" title="How to comment out a large block of lines in vi?">How to comment out a large block of lines in vi? </a></li>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-perl" rel="bookmark" title="Multi-line string in Perl">Multi-line string in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/simple-try-catch-block-in-perl" rel="bookmark" title="Simple try catch block in Perl">Simple try catch block in Perl </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>How can I comment out a large block of Perl code? </p>
<p><strong>Answer:</strong></p>
<p>Perl does not support multi-line comments like C++ or Java. If you want to comment out a large block of Perl code, there is still a trick.</p>
<pre><code>package Foo;

=pod
This is a multi-line comments 
more...
more...
=cut

print "Hello";</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/how-to-comment-out-a-large-block-of-lines-in-vi" rel="bookmark" title="How to comment out a large block of lines in vi?">How to comment out a large block of lines in vi? </a></li>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-perl" rel="bookmark" title="Multi-line string in Perl">Multi-line string in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/simple-try-catch-block-in-perl" rel="bookmark" title="Simple try catch block in Perl">Simple try catch block in Perl </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-can-i-comment-out-a-large-block-of-perl-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find a Perl Module&#8217;s Path</title>
		<link>http://www.linuxask.com/questions/how-to-find-a-perl-modules-path</link>
		<comments>http://www.linuxask.com/questions/how-to-find-a-perl-modules-path#comments</comments>
		<pubDate>Thu, 02 Dec 2010 06:13:19 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2573</guid>
		<description><![CDATA[How to find a Perl Module's Path Answer: For example, we want to know where the module JSON and related modules exist in the local file system, we can try: # perl -MJSON -e'print $_ . " => " . $INC{$_} . "\n" for keys %INC' attributes.pm => /usr/share/perl/5.10/attributes.pm XSLoader.pm => /usr/local/lib/perl/5.10.0/XSLoader.pm warnings/register.pm => /usr/share/perl/5.10/warnings/register.pm <a href='http://www.linuxask.com/questions/how-to-find-a-perl-modules-path' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/list-all-the-installed-perl-modules" rel="bookmark" title="List all the installed Perl modules">List all the installed Perl modules </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-get-the-full-list-of-ubuntus-managed-perl-modules" rel="bookmark" title="How to get the full list of Ubuntu&#8217;s managed Perl modules?">How to get the full list of Ubuntu&#8217;s managed Perl modules? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-remove-install-cpan-modules" rel="bookmark" title="How to remove install CPAN modules?">How to remove install CPAN modules? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>How to find a Perl Module's Path</p>
<p><strong>Answer:</strong></p>
<p>For example, we want to know where the module <strong>JSON </strong>and related modules exist in the local file system, we can try: </p>
<pre><code># perl -MJSON -e'print $_ . " => " . $INC{$_} . "\n" for keys %INC'

attributes.pm => /usr/share/perl/5.10/attributes.pm
XSLoader.pm => /usr/local/lib/perl/5.10.0/XSLoader.pm
warnings/register.pm => /usr/share/perl/5.10/warnings/register.pm
Carp.pm => /usr/share/perl/5.10/Carp.pm
Exporter/Heavy.pm => /usr/share/perl/5.10/Exporter/Heavy.pm
common/sense.pm => /usr/local/share/perl/5.10.0/common/sense.pm
vars.pm => /usr/share/perl/5.10/vars.pm
Exporter.pm => /usr/share/perl/5.10/Exporter.pm
strict.pm => /usr/share/perl/5.10/strict.pm
constant.pm => /usr/local/share/perl/5.10.0/constant.pm
warnings.pm => /usr/share/perl/5.10/warnings.pm
JSON/XS.pm => /usr/local/lib/perl/5.10.0/JSON/XS.pm
overload.pm => /usr/share/perl/5.10/overload.pm
base.pm => /usr/share/perl/5.10/base.pm
JSON.pm => /usr/local/share/perl/5.10.0/JSON.pm
</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/list-all-the-installed-perl-modules" rel="bookmark" title="List all the installed Perl modules">List all the installed Perl modules </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-get-the-full-list-of-ubuntus-managed-perl-modules" rel="bookmark" title="How to get the full list of Ubuntu&#8217;s managed Perl modules?">How to get the full list of Ubuntu&#8217;s managed Perl modules? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-remove-install-cpan-modules" rel="bookmark" title="How to remove install CPAN modules?">How to remove install CPAN modules? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-to-find-a-perl-modules-path/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to get the full list of Ubuntu&#8217;s managed Perl modules?</title>
		<link>http://www.linuxask.com/questions/how-to-get-the-full-list-of-ubuntus-managed-perl-modules</link>
		<comments>http://www.linuxask.com/questions/how-to-get-the-full-list-of-ubuntus-managed-perl-modules#comments</comments>
		<pubDate>Thu, 25 Nov 2010 16:01:59 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2596</guid>
		<description><![CDATA[How to get the full list of Ubuntu's managed Perl modules? Answer: The full list of Ubuntu's managed Perl modules is here (for lucid): http://packages.ubuntu.com/lucid/perl/ You can use apt-get into install those modules, instead of CPAN. The advantage is you can remove them easier with the apt-get command, while for CPAN, you need to do <a href='http://www.linuxask.com/questions/how-to-get-the-full-list-of-ubuntus-managed-perl-modules' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/list-all-the-installed-perl-modules" rel="bookmark" title="List all the installed Perl modules">List all the installed Perl modules </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-remove-install-cpan-modules" rel="bookmark" title="How to remove install CPAN modules?">How to remove install CPAN modules? </a></li>
<li><a href="http://www.linuxask.com/questions/install-perl-module-using-cpan" rel="bookmark" title="Install Perl module using CPAN">Install Perl module using CPAN </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>How to get the full list of Ubuntu's managed Perl modules?</p>
<p><strong>Answer:</strong></p>
<p>The full list of Ubuntu's managed Perl modules is here (for <strong>lucid</strong>): <a href="http://packages.ubuntu.com/lucid/perl/">http://packages.ubuntu.com/lucid/perl/ </a></p>
<p>You can use <strong>apt-get</strong> into install those modules, instead of <a href="http://www.linuxask.com/questions/install-perl-module-using-cpan">CPAN</a>. The advantage is you can remove them easier with the apt-get command, while for CPAN, you need to do it <a href="http://www.linuxask.com/questions/how-to-remove-install-cpan-modules">manually</a>. </p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/list-all-the-installed-perl-modules" rel="bookmark" title="List all the installed Perl modules">List all the installed Perl modules </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-remove-install-cpan-modules" rel="bookmark" title="How to remove install CPAN modules?">How to remove install CPAN modules? </a></li>
<li><a href="http://www.linuxask.com/questions/install-perl-module-using-cpan" rel="bookmark" title="Install Perl module using CPAN">Install Perl module using CPAN </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-to-get-the-full-list-of-ubuntus-managed-perl-modules/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write to the middle of a file in Perl</title>
		<link>http://www.linuxask.com/questions/write-to-the-middle-of-a-file-in-perl</link>
		<comments>http://www.linuxask.com/questions/write-to-the-middle-of-a-file-in-perl#comments</comments>
		<pubDate>Sun, 21 Nov 2010 13:16:28 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2219</guid>
		<description><![CDATA[Write to the middle of a file in Perl Answer: To write to the middle of a text file, can be easily performed by Perl. Assume the file has 10 lines, you want to replace the 5th line: #!/usr/bin/perl use strict; use Tie::File; my $file = 'foo.txt'; tie @array, 'Tie::File', $file or die "Cannot open <a href='http://www.linuxask.com/questions/write-to-the-middle-of-a-file-in-perl' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/a-simple-array-in-perl" rel="bookmark" title="A simple array in Perl">A simple array in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/array-reference-in-perl" rel="bookmark" title="Array reference in Perl">Array reference in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs" rel="bookmark" title="Enable Perl strict mode to restrict unsafe constructs">Enable Perl strict mode to restrict unsafe constructs </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Write to the middle of a file in Perl</p>
<p><strong>Answer:</strong></p>
<p>To write to the middle of a text file, can be easily performed by <strong>Perl</strong>.</p>
<p>Assume the file has 10 lines, you want to replace the <strong>5th </strong>line:</p>
<pre><code>#!/usr/bin/perl
use strict;
use Tie::File;

my $file = 'foo.txt';

tie @array, 'Tie::File', $file or die "Cannot open $file \n";

@array[4] = "Replaced!\n";
</code></pre>
<p>That's easy?</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/a-simple-array-in-perl" rel="bookmark" title="A simple array in Perl">A simple array in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/array-reference-in-perl" rel="bookmark" title="Array reference in Perl">Array reference in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/enable-perl-strict-mode-to-restrict-unsafe-constructs" rel="bookmark" title="Enable Perl strict mode to restrict unsafe constructs">Enable Perl strict mode to restrict unsafe constructs </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/write-to-the-middle-of-a-file-in-perl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is the difference between `&#124;&#124;` and `or` in Perl?</title>
		<link>http://www.linuxask.com/questions/what-is-the-difference-between-and-or-in-perl</link>
		<comments>http://www.linuxask.com/questions/what-is-the-difference-between-and-or-in-perl#comments</comments>
		<pubDate>Mon, 15 Nov 2010 15:24:59 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2144</guid>
		<description><![CDATA[What is the difference between &#124;&#124; and or in Perl? Answer: In Perl, sometimes you can use both `&#124;&#124;` and `or` to to do the same thing. But the main different is: or has very low precedence, which is useful for flow control Example: open FILE, $file or die("Cannot open $file"); # Work open FILE, <a href='http://www.linuxask.com/questions/what-is-the-difference-between-and-or-in-perl' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/write-to-the-middle-of-a-file-in-perl" rel="bookmark" title="Write to the middle of a file in Perl">Write to the middle of a file in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/difference-between-die-and-exit-in-perl" rel="bookmark" title="Difference between die and exit in Perl?">Difference between die and exit in Perl? </a></li>
<li><a href="http://www.linuxask.com/questions/search-and-replace-string-in-file-using-perl" rel="bookmark" title="Search and replace string in file using Perl">Search and replace string in file using Perl </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>What is the difference between <strong>||</strong> and <strong>or</strong> in Perl?</p>
<p><strong>Answer:</strong></p>
<p>In <strong>Perl</strong>, sometimes you can use both `<strong>||</strong>` and `<strong>or</strong>` to to do the same thing. But the main different is:</p>
<ul>
<li><strong>or </strong> has very low precedence, which is useful for flow control</li>
</ul>
<p>Example:</p>
<pre><code>open FILE,  $file or die("Cannot open $file");   # Work
open FILE,  $file || die("Cannot open $file");   # Does not work , because it it same as the next statement
open FILE, ($file || die("Cannot open $file"));  # Obviously not work
</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/write-to-the-middle-of-a-file-in-perl" rel="bookmark" title="Write to the middle of a file in Perl">Write to the middle of a file in Perl </a></li>
<li><a href="http://www.linuxask.com/questions/difference-between-die-and-exit-in-perl" rel="bookmark" title="Difference between die and exit in Perl?">Difference between die and exit in Perl? </a></li>
<li><a href="http://www.linuxask.com/questions/search-and-replace-string-in-file-using-perl" rel="bookmark" title="Search and replace string in file using Perl">Search and replace string in file using Perl </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/what-is-the-difference-between-and-or-in-perl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
