60 PerlMonks - Newest Nodes New nodes appearing on PerlMonks http://perlmonks.org/index.pl?node_id=30175 http://blogs.law.harvard.edu/tech/rss PerlMonks Newest Nodes XML Generator 961 PerlMonks 2014-09-17 00:51:10 rss,clean Tue Sep 16 14:51:10 2014 30 20140916145110 Tue Sep 16 14:51:10 2014 http://perlmonks.org/ Anonymous Monk Reaped: fake hermes uk NodeReaper http://perlmonks.org/index.pl?node_id=1100864 This node was taken out by the <a href="?node=NodeReaper">NodeReaper</a> on Sep 17, 2014 at 00:30&nbsp;UTCReason: &#91;<a href="?node=atcroft">atcroft</a>&#93;: Reap: probable spamYou may view &#91;href://?node=Visit%20Reaped%20Nodes&nodenum=1100864|th... perlquestion Tue, 16 Sep 2014 23:41:42 +0000 http://perlmonks.org/index.pl?node_id=1100864 1100864 52855 2014-09-16 19:41:42 NodeReaper How do I delete lines matching a certain condition and make sure each line has the right prefix and suffix? cjff150 http://perlmonks.org/index.pl?node_id=1100861 Hello, I'd appreciate any guidance on this -- I'm very new to PERL and can't crack this one. I have a pipe delimited file and the beginning of each line must start with | and end with || (no spac... perlquestion Tue, 16 Sep 2014 23:17:42 +0000 http://perlmonks.org/index.pl?node_id=1100861 1100861 1100851 2014-09-16 19:17:42 cjff150 Perl regex \G /g and /gc tj_thompson http://perlmonks.org/index.pl?node_id=1100860 Hello monks, I've recently been doing a large amount of parsing and have wandered into a bit of a quandary related to regexes, \G, and /g. My recent code has been some state based lexing/p... perlquestion Tue, 16 Sep 2014 23:03:15 +0000 http://perlmonks.org/index.pl?node_id=1100860 1100860 832109 2014-09-16 19:03:15 tj_thompson Parse Chat Log to CSV Redfish76 http://perlmonks.org/index.pl?node_id=1100853 I have a couple of chat logs I would like to parse to a csv. I am a noob to perl but think this should be fairly simple. Below is an example T 1310234540 1919 This i... perlquestion Tue, 16 Sep 2014 22:29:07 +0000 http://perlmonks.org/index.pl?node_id=1100853 1100853 1100848 2014-09-16 18:29:07 Redfish76 Text::CSV not able to execute insert query dynamically. Ankur_kuls http://perlmonks.org/index.pl?node_id=1100831 Hi, I have the below script which reads one csv file in a directory, connect to the SQLite database, and insert the data of csv files into the database tables.. #! /usr/bin/perl us... perlquestion Tue, 16 Sep 2014 20:15:01 +0000 http://perlmonks.org/index.pl?node_id=1100831 1100831 1084250 2014-09-16 16:15:01 Ankur_kuls Error while using POSIX strftime sravs448 http://perlmonks.org/index.pl?node_id=1100829 I am getting an error using POSIX . strftime. I followed the guidelines mentioned in perldoc http://perldoc.perl.org/functions/localtime.html what is the mistake I did here ... perlquestion Tue, 16 Sep 2014 20:02:46 +0000 http://perlmonks.org/index.pl?node_id=1100829 1100829 1096125 2014-09-16 16:02:46 sravs448 Identifying scripts (writing systems) AppleFritter http://perlmonks.org/index.pl?node_id=1100846 Dear monks and nuns, priests and scribes, popes and antipopes, saints and stowaways lurking in the monastery, lend me your ears. (I promise I'll return them.) I'm still hardly an experienced Perl... CUFP Tue, 16 Sep 2014 21:32:16 +0000 http://perlmonks.org/index.pl?node_id=1100846 1100846 1084031 2014-09-16 17:32:16 AppleFritter Re: perl6 match variable raiph http://perlmonks.org/index.pl?node_id=1100869 Fwiw this seems to be <a href="https://rt.perl.org/Ticket/Display.html?id=118705">bug #118705</a>. . o O ( "&#91;id://1041369|the celebrity tell-all ... note Wed, 17 Sep 2014 00:22:04 +0000 http://perlmonks.org/index.pl?node_id=1100869 1100869 698487 2014-09-16 20:22:04 raiph Re: Moscow time zone change in October 2014 sundialsvc4 http://perlmonks.org/index.pl?node_id=1100868 it superficially appears to me that <a href="http://search.cpan.org/perldoc?Time%3A%3AZone">Time::Zone</a> contains hard-coded time-zone offsets, which is probably not a sound algorithmic approach. &nbsp; Whereas <a href="http://search.cpan.org/perldoc?DateTime%3A%3ATimeZone">DateTime::TimeZone</a> appears... note Wed, 17 Sep 2014 00:15:07 +0000 http://perlmonks.org/index.pl?node_id=1100868 1100868 647953 2014-09-16 20:15:07 sundialsvc4 Re: Perl regex \G /g and /gc Anonymous Monk http://perlmonks.org/index.pl?node_id=1100867 see <a href="?node_id=1037552">Re: Count Quoted Words</a>, <a href="?node_id=1082558">Re: Help required in find command. (read parse file tokenize m//gc)</a>, <a href="?node_id=998391">Re^2: Help with regular expression ( m/\G/gc )</a>, <a href="http://perldoc.perl.org/perlfaq6.html">perlfaq6</a>#&#91;href://http... note Wed, 17 Sep 2014 00:12:41 +0000 http://perlmonks.org/index.pl?node_id=1100867 1100867 961 2014-09-16 20:12:41 Anonymous Monk Re: How do I delete lines matching a certain condition and make sure each line has the right prefix and suffix? sundialsvc4 http://perlmonks.org/index.pl?node_id=1100866 In general, I like to approach problems like this in a slightly different way: &nbsp; I will read &ldquo;the original file,&rdquo; one record at a time, in a loop, and decide which records from t... note Wed, 17 Sep 2014 00:09:28 +0000 http://perlmonks.org/index.pl?node_id=1100866 1100866 647953 2014-09-16 20:09:28 sundialsvc4 Re: How do I delete lines matching a certain condition and make sure each line has the right prefix and suffix? kennethk http://perlmonks.org/index.pl?node_id=1100865 Welcome to the Monastary, <a href="?node=cjff150">cjff150</a>. As a note, it's considered good form to wrap not just code in tags, but input and output as well, in order to avoid whitespace mangling and other fo... note Tue, 16 Sep 2014 23:51:01 +0000 http://perlmonks.org/index.pl?node_id=1100865 1100865 712372 2014-09-16 19:51:01 kennethk Re^3: Text::CSV not able to execute insert query dynamically. kennethk http://perlmonks.org/index.pl?node_id=1100859 Did you try the suggested code for your insert? Sorry for any lack of clarity in the explanation. ... note Tue, 16 Sep 2014 23:03:15 +0000 http://perlmonks.org/index.pl?node_id=1100859 1100859 712372 2014-09-16 19:03:15 kennethk Re: Parse Chat Log to CSV Anonymous Monk http://perlmonks.org/index.pl?node_id=1100858 ... Any idea's? Go ahead :) try someting from <a href="http://perldoc.perl.org/perlintro.html">perlintro</a>#<a href="http://perldoc.perl.org/perlintro.html#Simple-matching">Simple matching</a>, <a href="http://perldoc.perl.org/perlintro.html">perlintro</a>#<a href="http://perldoc.perl.org/perlintro.html#Simple-substitution">Simple substitution</a>, <a href="http://perldoc.perl.org/perlintro.html">perlintro</a>#&#91;doc://pe... note Tue, 16 Sep 2014 23:03:13 +0000 http://perlmonks.org/index.pl?node_id=1100858 1100858 961 2014-09-16 19:03:13 Anonymous Monk Re: Problem creating animated GIF using GD and GD::Graph Anonymous Monk http://perlmonks.org/index.pl?node_id=1100857 also you forgot <a href="http://perldoc.perl.org/functions/binmode.html">binmode</a>... note Tue, 16 Sep 2014 22:59:40 +0000 http://perlmonks.org/index.pl?node_id=1100857 1100857 961 2014-09-16 18:59:40 Anonymous Monk Re: Excel reading problem Anonymous Monk http://perlmonks.org/index.pl?node_id=1100856 <a href="?node=excel%20button">excel button</a>, <a href="?node=excel%20format">excel format</a>, <a href="https://duckduckgo.com/html/?q=site%3Aperlmonks.org%20excel%20button">site:perlmonks.org excel button</a>, <a href="https://duckduckgo.com/html/?q=site%3Aperlmonks.org%20excel%20format">site:perlmonks.org excel format</a> <a href="?node=excel%20button">excel button</a>, <a href="?node=excel%20format">excel format</a>, <a href="https://duckduckgo.com/html/?q=site%3Aperlmonks.org%20excel%20button">site:perlmonks.org excel button</a>, &#91;dd... note Tue, 16 Sep 2014 22:58:15 +0000 http://perlmonks.org/index.pl?node_id=1100856 1100856 961 2014-09-16 18:58:15 Anonymous Monk Re^2: Identifying scripts (writing systems) AppleFritter http://perlmonks.org/index.pl?node_id=1100855 Ah, I had a hunch there would be another solution, one that I'd overlooked! Indeed, you're right, the following also works: use Unicode::UCD qw/charscript/; # ... my %scripts... note Tue, 16 Sep 2014 22:45:22 +0000 http://perlmonks.org/index.pl?node_id=1100855 1100855 1084031 2014-09-16 18:45:22 AppleFritter Re: HTML::Template data loading Anonymous Monk http://perlmonks.org/index.pl?node_id=1100854 There is too much stuff in your post, what is the absolute minimum required to reproduce the problem?... note Tue, 16 Sep 2014 22:36:02 +0000 http://perlmonks.org/index.pl?node_id=1100854 1100854 961 2014-09-16 18:36:02 Anonymous Monk Re: Identifying scripts (writing systems) Anonymous Monk http://perlmonks.org/index.pl?node_id=1100850 Perhaps charscript() and charscripts() from <a href="http://perldoc.perl.org/Unicode/UCD.html">Unicode::UCD</a> could help?... note Tue, 16 Sep 2014 22:28:02 +0000 http://perlmonks.org/index.pl?node_id=1100850 1100850 961 2014-09-16 18:28:02 Anonymous Monk Re: Identifying scripts (writing systems) RonW http://perlmonks.org/index.pl?node_id=1100847 Very well done, brother (sister?) ... note Tue, 16 Sep 2014 21:46:37 +0000 http://perlmonks.org/index.pl?node_id=1100847 1100847 1080444 2014-09-16 17:46:37 RonW Re^5: Error while using POSIX strftime Anonymous Monk http://perlmonks.org/index.pl?node_id=1100845 <a href="?node=toolic">toolic</a> asked you to post the output of perl -v so we can get a better picture of your system; even better, post the output of perl -V. Are you using Strawberry Perl, cygwin, or Acti... note Tue, 16 Sep 2014 21:18:16 +0000 http://perlmonks.org/index.pl?node_id=1100845 1100845 961 2014-09-16 17:18:16 Anonymous Monk Re^3: Removing everything before the first comma separator on each line of a text file Anonymous Monk http://perlmonks.org/index.pl?node_id=1100844 <a href="?node=johngg">johngg</a> is using a &#91;doc://perlop#... note Tue, 16 Sep 2014 21:06:01 +0000 http://perlmonks.org/index.pl?node_id=1100844 1100844 961 2014-09-16 17:06:01 Anonymous Monk Re^2: Text::CSV not able to execute insert query dynamically. Ankur_kuls http://perlmonks.org/index.pl?node_id=1100843 hi...its not giving any error.. when I run the 1st insert query its storing the field values of csv file (like 34, 67, 29) but when I run the second insert statement instead...it giving me values l... note Tue, 16 Sep 2014 21:03:11 +0000 http://perlmonks.org/index.pl?node_id=1100843 1100843 1084250 2014-09-16 17:03:11 Ankur_kuls Re^3: Error while using POSIX strftime Anonymous Monk http://perlmonks.org/index.pl?node_id=1100842 Item 2 and 4 on the <a href="?node=Basic%20debugging%20checklist">Basic debugging checklist</a>: look at your data. use strict; use warnings; use POSIX qw(strftime); my @lt = localtime; use Data::Dumper; print Dumper(\@lt); my $... note Tue, 16 Sep 2014 20:49:13 +0000 http://perlmonks.org/index.pl?node_id=1100842 1100842 961 2014-09-16 16:49:13 Anonymous Monk Re^3: Text::CSV not able to execute insert query dynamically. kennethk http://perlmonks.org/index.pl?node_id=1100841 But if you don't <a href="http://perldoc.perl.org/functions/eval.html">eval</a> the string, Perl won't know to interpolate the values; it just inserts the literal $row->&#91;0&#93;. See my post above for a better solution. ... note Tue, 16 Sep 2014 20:45:07 +0000 http://perlmonks.org/index.pl?node_id=1100841 1100841 712372 2014-09-16 16:45:07 kennethk Re: Error while using POSIX strftime Corion http://perlmonks.org/index.pl?node_id=1100840 I cannot reproduce that error. Code used: use strict; use warnings; use POSIX qw(strftime); my $datestring = strftime "%B %d %Y", localtime; print("date - $datestring\n"); ... note Tue, 16 Sep 2014 20:44:13 +0000 http://perlmonks.org/index.pl?node_id=1100840 1100840 5348 2014-09-16 16:44:13 Corion Re^2: Text::CSV not able to execute insert query dynamically. Ankur_kuls http://perlmonks.org/index.pl?node_id=1100839 hi...its giving the expected value of $query '$row->&#91;0&#93;', '$row-><a href="?node=1">1</a>', '$row-><a href="?node=2">2</a>', '$row-><a href="?node=3">3</a>' ... note Tue, 16 Sep 2014 20:42:46 +0000 http://perlmonks.org/index.pl?node_id=1100839 1100839 1084250 2014-09-16 16:42:46 Ankur_kuls Re^3: Removing everything before the first comma separator on each line of a text file Anonymous Monk http://perlmonks.org/index.pl?node_id=1100838 In quite a few cases it's possible to execute one-liners autonomously, for example from a <a href="http://www.freebsd.org/cgi/man.cgi?query=crontab&amp;sektion=5&amp;manpath=SuSE+Linux/i386+11.3">crontab(5)</a>. But I'm assuming you mean you'd rather have a script file, which is easier to... note Tue, 16 Sep 2014 20:41:01 +0000 http://perlmonks.org/index.pl?node_id=1100838 1100838 961 2014-09-16 16:41:01 Anonymous Monk Re^4: Error while using POSIX strftime sravs448 http://perlmonks.org/index.pl?node_id=1100837 version 5.16.3... note Tue, 16 Sep 2014 20:40:27 +0000 http://perlmonks.org/index.pl?node_id=1100837 1100837 1096125 2014-09-16 16:40:27 sravs448 Re^3: Error while using POSIX strftime toolic http://perlmonks.org/index.pl?node_id=1100836 What version of Perl are you using? Perhaps it is a bug in an old version of <a href="http://perldoc.perl.org/POSIX.html">POSIX</a> perl -v ... note Tue, 16 Sep 2014 20:34:06 +0000 http://perlmonks.org/index.pl?node_id=1100836 1100836 622051 2014-09-16 16:34:06 toolic Re^2: Removing everything before the first comma separator on each line of a text file zodell http://perlmonks.org/index.pl?node_id=1100835 I got it working but not as a one liner, thank you for your help. Great Advice while (){ s/^(?:L\d+|DETAIL|SPACE|SUMMARY),//; print $out $_; } ... note Tue, 16 Sep 2014 20:32:01 +0000 http://perlmonks.org/index.pl?node_id=1100835 1100835 1100640 2014-09-16 16:32:01 zodell Re: Text::CSV not able to execute insert query dynamically. GotToBTru http://perlmonks.org/index.pl?node_id=1100834 When you run this, what does the print $query output look like? 1 Peter 4... note Tue, 16 Sep 2014 20:29:16 +0000 http://perlmonks.org/index.pl?node_id=1100834 1100834 844862 2014-09-16 16:29:16 GotToBTru Re: Text::CSV not able to execute insert query dynamically. kennethk http://perlmonks.org/index.pl?node_id=1100833 What is the error message you are getting? I think you'll get a lot of clarity if you swap your connector to: $dbh = DBI->connect('DBI:SQLite:vodafone.db', { ... note Tue, 16 Sep 2014 20:27:25 +0000 http://perlmonks.org/index.pl?node_id=1100833 1100833 712372 2014-09-16 16:27:25 kennethk Re^2: Error while using POSIX strftime sravs448 http://perlmonks.org/index.pl?node_id=1100832 Yes. It throws the same error after adding "my" as well. Updated the code. But I am still getting the same error.... note Tue, 16 Sep 2014 20:18:07 +0000 http://perlmonks.org/index.pl?node_id=1100832 1100832 1096125 2014-09-16 16:18:07 sravs448 Re: Error while using POSIX strftime Anonymous Monk http://perlmonks.org/index.pl?node_id=1100830 This code doesn't compile, and when I add the missing my, the code works for me. Please post code that compiles and reproduces the problem. Note that you probably want to use &#91;doc://... note Tue, 16 Sep 2014 20:08:58 +0000 http://perlmonks.org/index.pl?node_id=1100830 1100830 961 2014-09-16 16:08:58 Anonymous Monk Re^3: whats wrong? it gives me many error LanX http://perlmonks.org/index.pl?node_id=1100828 &gt; my ($host, $port, $request, $proto) = ('tcp'); my ($proto, $host, $port, $request) = ('tcp'); But ikegami already showed this on SO... :) ... note Tue, 16 Sep 2014 19:59:16 +0000 http://perlmonks.org/index.pl?node_id=1100828 1100828 708738 2014-09-16 15:59:16 LanX Re^2: Removing everything before the first comma separator on each line of a text file zodell http://perlmonks.org/index.pl?node_id=1100827 Quick question..in your reply, you have the actual text from the file within the code? Or is that to show what portion of the data that code is to be affecting?... note Tue, 16 Sep 2014 19:58:55 +0000 http://perlmonks.org/index.pl?node_id=1100827 1100827 1100640 2014-09-16 15:58:55 zodell Re^3: AI Neural Networks based Prediciton GotToBTru http://perlmonks.org/index.pl?node_id=1100826 You need to define what output you want for a given input. You train the neural network by supplying both the input and the output, and it makes the internal adjustments to produce those results.... note Tue, 16 Sep 2014 19:58:27 +0000 http://perlmonks.org/index.pl?node_id=1100826 1100826 844862 2014-09-16 15:58:27 GotToBTru Re^2: Removing everything before the first comma separator on each line of a text file zodell http://perlmonks.org/index.pl?node_id=1100825 This may be a stupid question, but if I am running this script on a server rather than in a command prompt and the script is to be executed autonomously...how would I implement a one liner such as ... note Tue, 16 Sep 2014 19:56:02 +0000 http://perlmonks.org/index.pl?node_id=1100825 1100825 1100640 2014-09-16 15:56:02 zodell Re^2: how to speed up pattern match between two files Anonymous Monk http://perlmonks.org/index.pl?node_id=1100818 Thank you for your reply. Ill do that. Unlike the previous reply its really informative and helpful ... note Tue, 16 Sep 2014 19:25:53 +0000 http://perlmonks.org/index.pl?node_id=1100818 1100818 961 2014-09-16 15:25:53 Anonymous Monk Re^3: whats wrong? it gives me many error blue_cowdawg http://perlmonks.org/index.pl?node_id=1100817 Personally I'd go with the latter. Peter L. Berghold -- Unix Professional Peter... note Tue, 16 Sep 2014 19:25:38 +0000 http://perlmonks.org/index.pl?node_id=1100817 1100817 72516 2014-09-16 15:25:38 blue_cowdawg Re: Moscow time zone change in October 2014 ikegami http://perlmonks.org/index.pl?node_id=1100816 Seems Time::Zone was never adjusted in 2011, so it already has the new value. "msk" => +3*3600, # Moscow I don't know why you'd ever want to use Time::Zone. In addition to the m... note Tue, 16 Sep 2014 19:15:32 +0000 http://perlmonks.org/index.pl?node_id=1100816 1100816 381608 2014-09-16 15:15:32 ikegami Re^2: DBI bind_columns fionbarr http://perlmonks.org/index.pl?node_id=1100815 O'Reilly 'Perl DBI' page 129 has the 'undef' page 227 no 'undef'... note Tue, 16 Sep 2014 19:06:50 +0000 http://perlmonks.org/index.pl?node_id=1100815 1100815 505086 2014-09-16 15:06:50 fionbarr Re: comparing sequence fasta headers Lennotoecom http://perlmonks.org/index.pl?node_id=1100814 use Inline::Files; undef $h{$_} while chomp($_ = ); while(){ print if /(^\w{3})/ and exists $h{$1}; } __CODES__ lus cel cfa __FASTA__ where do you study your p... note Tue, 16 Sep 2014 19:05:35 +0000 http://perlmonks.org/index.pl?node_id=1100814 1100814 1055200 2014-09-16 15:05:35 Lennotoecom Re^2: whats wrong? it gives me many error linuxer http://perlmonks.org/index.pl?node_id=1100813 my ($host, $port, $request, $proto) = ('tcp'); But that assigns 'tcp' to $host. Shouldn't it be assigned to $proto? So, maybe one of these: my ($host, $port, $r... note Tue, 16 Sep 2014 18:53:19 +0000 http://perlmonks.org/index.pl?node_id=1100813 1100813 590906 2014-09-16 14:53:19 linuxer mae mae http://perlmonks.org/index.pl?node_id=1100862 user Tue, 16 Sep 2014 23:32:09 +0000 http://perlmonks.org/index.pl?node_id=1100862 1100862 1100862 2014-09-16 19:32:09 mae cjff150 cjff150 http://perlmonks.org/index.pl?node_id=1100851 user Tue, 16 Sep 2014 22:28:52 +0000 http://perlmonks.org/index.pl?node_id=1100851 1100851 1100851 2014-09-16 18:28:52 cjff150 Redfish76 Redfish76 http://perlmonks.org/index.pl?node_id=1100848 user Tue, 16 Sep 2014 22:19:27 +0000 http://perlmonks.org/index.pl?node_id=1100848 1100848 1100848 2014-09-16 18:19:27 Redfish76 ManyGoodBytes ManyGoodBytes http://perlmonks.org/index.pl?node_id=1100823 Freshman at TWU. Majoring in Computer Science.... user Tue, 16 Sep 2014 19:55:57 +0000 http://perlmonks.org/index.pl?node_id=1100823 1100823 1100823 2014-09-16 15:55:57 ManyGoodBytes tanjir tanjir http://perlmonks.org/index.pl?node_id=1100821 user Tue, 16 Sep 2014 19:53:15 +0000 http://perlmonks.org/index.pl?node_id=1100821 1100821 1100821 2014-09-16 15:53:15 tanjir geestar11 geestar11 http://perlmonks.org/index.pl?node_id=1100819 user Tue, 16 Sep 2014 19:43:37 +0000 http://perlmonks.org/index.pl?node_id=1100819 1100819 1100819 2014-09-16 15:43:37 geestar11