Mojolicious-Plugin-FeedReader
view release on metacpan or search on metacpan
t/samples/perlmonks.html view on Meta::CPAN
<td valign="top" style="padding-left:.2em">
<!-- TITLE -->
<a id ="post-head-id1104960"
name="post-head-id1104960"
href="?node_id=1104960"
>Sorting/Cleansing a Duplicate File</a>
<br/>
<!-- REPLIES -->
4 direct replies — <a href="?node_id=1104960">Read more / Contribute</a>
</td>
<td valign="top" align="right" style="padding-right:.2em">
<!-- AUTHOR -->
by <a href="?node_id=1052035">perlron</a>
<br/>
<!-- DATE -->
on Oct 25, 2014 at 09:24
</td>
</tr>
<tr class="post-voterep">
<td colspan="2" class="voterep">
</td>
</tr>
<tr class="post-body post_body">
<td colspan="2">
<ul>Hi,
<br />
With a desire to write elegant/optimal code in perl,i want to know any suggestions the monks might have to spare me.
<br />A customer gave me a word document with country (duplicates due to multiple commitees per country)names. <br />I need to create a drop down in html showing country names.
Hence my trivial code below to read a list of duplicate country names , identify unique names and write them to a file in alphabetical order. Basic stuff.
<br />
<pre class="code"><div class='codeblock'><tt class='codetext'>#!/usr/bin/perl
use strict;
my ($key,$name,%countries);
open (my $fh1,"<","files/country_listv1.txt") or die $!;
while(<$fh1>){
if (!exists $countries{$_}){
$countries{$_} = '1';
}
}
open (my $fh2,">","files/country_listv2.txt") or die $!;
foreach $key (sort keys %countries){
print $fh2 $key;
}
close($fh1,$fh2);
</tt></div><div class='embed-code-dl'><a href="?abspart=1;displaytype=displaycode;node_id=1104960;part=1">[download]</a></div></pre>
update
<i>I still have one issue the comma character appears as ÂTM. I suspect its a encoding issue of my text file. I am using textedit on a mac which doesnt seem to have a save as UTF8 option.strange. Im just updating this query than create a new one.
Im going to try some options but please tell me which is the best way out, as this problem seems a generic one.
use utf8 encoding in my perl script.
recreate the text file in vim
any other options ?
</i>
<br />
<br />
Do we have some perl code checker available for us to validate scripts / modules ?
<br />Thanks
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-1052035">
<i>Do not wait to strike when the iron is hot! Make it hot by striking - WB Yeats</i>
</div></div></ul>
</td>
</tr>
<!-- End Post -->
<!-- Begin Post -->
<!-- embed node with vote container -->
<tr class="post-head post_head">
<td valign="top" style="padding-left:.2em">
<!-- TITLE -->
<a id ="post-head-id1104905"
name="post-head-id1104905"
href="?node_id=1104905"
>Making PDF Tables</a>
<br/>
<!-- REPLIES -->
2 direct replies — <a href="?node_id=1104905">Read more / Contribute</a>
</td>
<td valign="top" align="right" style="padding-right:.2em">
<!-- AUTHOR -->
by <a href="?node_id=961">Anonymous Monk</a>
<br/>
<!-- DATE -->
on Oct 24, 2014 at 15:13
</td>
</tr>
<tr class="post-voterep">
<td colspan="2" class="voterep">
</td>
</tr>
<tr class="post-body post_body">
<td colspan="2">
<ul>Hi Monks!<br />
I need to create a PDF document with a few tables in it, from the code sample of the module PDF::Table its simple to have one table in the same page of a PDF, but I canÂt figure it out how I would add another table into the same PDF page. Has any of...
Code Sample<br />
<pre class="code"><div class='codeblock'><tt class='codetext'> use PDF::API2;
use PDF::Table;
my $pdftable = new PDF::Table;
my $pdf = new PDF::API2(-file => "table_of_lorem.pdf");
my $page = $pdf->page;
# some data to layout
my $some_data =[
["1 Lorem ipsum dolor",
"Donec odio neque, faucibus vel",
"consequat quis, tincidunt vel, felis."],
["Nulla euismod sem eget neque.",
"Donec odio neque",
"Sed eu velit."],
#... and so on
];
( run in 1.716 second using v1.01-cache-2.11-cpan-39bf76dae61 )