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 Wed Jan 18 03:11:58 2017 961 30 Anonymous Monk PerlMonks clean,rss http://perlmonks.org/ 20170118031158 2017-01-18 14:11:58 Wed Jan 18 03:11:58 2017 Feature Idea: qr//e haukex http://perlmonks.org/index.pl?node_id=1179847 Dear Monks, As I was thinking about <a href="?node_id=1179840">this node</a> about dynamically building regexes, I had the idle thought that it might be nice if qr// supported qr//e, analogou... perlquestion Wed, 18 Jan 2017 13:47:45 +0000 http://perlmonks.org/index.pl?node_id=1179847 1179847 830549 2017-01-18 08:47:45 haukex ActiveState new vs old? enrgyxprt http://perlmonks.org/index.pl?node_id=1179841 Its been a while since I installed ActiveState perl, perl -V shows I have V5 something... So I updated all using PPM.. Now I am thinking about updating to the newest activestate community version.... perlquestion Wed, 18 Jan 2017 12:59:36 +0000 http://perlmonks.org/index.pl?node_id=1179841 1179841 1179577 2017-01-18 07:59:36 enrgyxprt Last service name comes up empty in NMAP Parser Noosrep http://perlmonks.org/index.pl?node_id=1179825 Hi, I have an XML file that is generated as follows: ... perlquestion Wed, 18 Jan 2017 10:53:56 +0000 http://perlmonks.org/index.pl?node_id=1179825 1179825 1174130 2017-01-18 05:53:56 Noosrep whats wrong with this code? purnak http://perlmonks.org/index.pl?node_id=1179814 Sorry if im being stupid, but i just dont understand what is wrong with this piece of code? my @array=(1..10); print "@array\n"; foreach(@array){ shift (@array); print "@array\n"; } ... perlquestion Wed, 18 Jan 2017 08:53:18 +0000 http://perlmonks.org/index.pl?node_id=1179814 1179814 1179811 2017-01-18 03:53:18 purnak [RFC] Building Regex Alternations Dynamically haukex http://perlmonks.org/index.pl?node_id=1179840 Dear Monks, this is a suggestion for a tutorial, any comments or suggestions are welcome. Update 1: Fixed up explanation of metacharacters a bit. I thought it might be useful to expl... perlmeditation Wed, 18 Jan 2017 12:57:13 +0000 http://perlmonks.org/index.pl?node_id=1179840 1179840 830549 2017-01-18 07:57:13 haukex Re^4: perl equiv to cmd start haukex http://perlmonks.org/index.pl?node_id=1179852 Hi <a href="?node=soonix">soonix</a>, the qq function I know I'm probably being overly pedantic, but I AFAIK qq and related (q, qw, qx, etc.) aren't func... note Wed, 18 Jan 2017 14:08:32 +0000 http://perlmonks.org/index.pl?node_id=1179852 1179852 830549 2017-01-18 09:08:32 haukex Re^2: [RFC] Building Regex Alternations Dynamically haukex http://perlmonks.org/index.pl?node_id=1179851 Hi <a href="?node=LanX">LanX</a>, Thanks for your comments, I'll think about whether I can provide a TL;DR version - my thought was that impatient users could just copy-n-paste my code :-) IIR... note Wed, 18 Jan 2017 14:03:58 +0000 http://perlmonks.org/index.pl?node_id=1179851 1179851 830549 2017-01-18 09:03:58 haukex Re: [RFC] Building Regex Alternations Dynamically LanX http://perlmonks.org/index.pl?node_id=1179850 it's almost TL;DR, so two separate posts my have been better. :) Just three remarks: IIRC there is a hard limit for the length of a regex-string ... (or was it only the repetition co... note Wed, 18 Jan 2017 13:56:23 +0000 http://perlmonks.org/index.pl?node_id=1179850 1179850 708738 2017-01-18 08:56:23 LanX Re: ActiveState new vs old? BillKSmith http://perlmonks.org/index.pl?node_id=1179849 I have encountered a minor downside. Occasionally ActiveState removes modules from PPM. The one time I needed one of those modules, another monk was able to give me directions to get a compatible c... note Wed, 18 Jan 2017 13:51:46 +0000 http://perlmonks.org/index.pl?node_id=1179849 1179849 957973 2017-01-18 08:51:46 BillKSmith Re^3: perl equiv to cmd start soonix http://perlmonks.org/index.pl?node_id=1179848 to avoid backslash-orgies like this, you might be interested in the qq function. The corresponding entry in <a href="http://perldoc.perl.org/perlfunc.html">perlfunc</a> is a bit terse, but see <a href="http://perldoc.perl.org/perlop.html">perlop</a> under &#91;doc://perlop#Quote-and... note Wed, 18 Jan 2017 13:49:39 +0000 http://perlmonks.org/index.pl?node_id=1179848 1179848 1015412 2017-01-18 08:49:39 soonix Re^4: protect excel file in perl script arunks http://perlmonks.org/index.pl?node_id=1179846 any sample code available .please share... note Wed, 18 Jan 2017 13:39:08 +0000 http://perlmonks.org/index.pl?node_id=1179846 1179846 1179740 2017-01-18 08:39:08 arunks Re: ActiveState new vs old? (updated) haukex http://perlmonks.org/index.pl?node_id=1179845 Hi <a href="?node=enrgyxprt">enrgyxprt</a>, That "something" is kind of important, since the first release of v5.something was in 1994 and v5.24 was released last year :-) In general, newer versions are of cou... note Wed, 18 Jan 2017 13:11:54 +0000 http://perlmonks.org/index.pl?node_id=1179845 1179845 830549 2017-01-18 08:11:54 haukex Re^3: whats wrong with this code? LanX http://perlmonks.org/index.pl?node_id=1179844 granted! :) Cheers Rolf (addicted to the Perl Programming Language and &#91;http://i.dailymail.co.uk/i/pix/2014/07/14/article-2690897-1F... note Wed, 18 Jan 2017 13:08:41 +0000 http://perlmonks.org/index.pl?node_id=1179844 1179844 708738 2017-01-18 08:08:41 LanX Re^2: whats wrong with this code? afoken http://perlmonks.org/index.pl?node_id=1179843 my @array= 1..10; do { print "@array\n" } while defined shift @array; That does not work if @array may conain undef. >perl -Mstrict -w -M-w... note Wed, 18 Jan 2017 13:06:38 +0000 http://perlmonks.org/index.pl?node_id=1179843 1179843 747201 2017-01-18 08:06:38 afoken Re^3: whats wrong with this code? LanX http://perlmonks.org/index.pl?node_id=1179842 &gt; wanted to know whats the problem with foreach? most probably is <a href="http://perldoc.perl.org/foreach.html">foreach</a> internally holding an index to iterate the array. So it must terminate... note Wed, 18 Jan 2017 12:59:46 +0000 http://perlmonks.org/index.pl?node_id=1179842 1179842 708738 2017-01-18 07:59:46 LanX Re^3: whats wrong with this code? Marshall http://perlmonks.org/index.pl?node_id=1179837 Glad to hear that this is helping. I was worried about confusing things more. A few more comments about the difference between "while" and "foreach".. This while loop is testing whether or... note Wed, 18 Jan 2017 12:16:30 +0000 http://perlmonks.org/index.pl?node_id=1179837 1179837 732669 2017-01-18 07:16:30 Marshall Re^14: [Answered; thanks.] Can this be explained in layman's terms? Anonymous Monk http://perlmonks.org/index.pl?node_id=1179836 Its too late to change history, leaving the node here perfectly demonstrates why you should be stripped of any special powers at perlmonks -- you've taken the place of sundial-- go away... note Wed, 18 Jan 2017 12:12:39 +0000 http://perlmonks.org/index.pl?node_id=1179836 1179836 961 2017-01-18 07:12:39 Anonymous Monk Re: whats wrong with this code? johngg http://perlmonks.org/index.pl?node_id=1179835 Not answering your question but in the spirit of TIMTOWTDI, just having a play with recursion for the fun of it. johngg@shiraz:~ > perl -Mstrict -Mwarnings -E ' my @arr = ( 1 .. 10 );... note Wed, 18 Jan 2017 12:02:56 +0000 http://perlmonks.org/index.pl?node_id=1179835 1179835 401112 2017-01-18 07:02:56 johngg Re: whats wrong with this code? LanX http://perlmonks.org/index.pl?node_id=1179834 While I prefer <a href="?node=Marshall">Marshall</a>'s <a href="?node_id=1179824">solution</a>, TIMTOWTDI for completeness two other approaches: use strict; use warnings; my @array= 1..10; do { print "@array\n" } w... note Wed, 18 Jan 2017 11:55:35 +0000 http://perlmonks.org/index.pl?node_id=1179834 1179834 708738 2017-01-18 06:55:35 LanX Re^3: whats wrong with this code? Discipulus http://perlmonks.org/index.pl?node_id=1179833 Sorry perhaps i've not noticed your first print "@array\n"; statement (or you have added it? ;=) L* There are no rules, th... note Wed, 18 Jan 2017 11:40:53 +0000 http://perlmonks.org/index.pl?node_id=1179833 1179833 174111 2017-01-18 06:40:53 Discipulus Re^2: Last service name comes up empty in NMAP Parser Noosrep http://perlmonks.org/index.pl?node_id=1179832 Module was NMAP::Parser, I thought that was clear from my question but I guess not :) Either way, you and Huck were right. Removing the \n was the solution..... note Wed, 18 Jan 2017 11:25:03 +0000 http://perlmonks.org/index.pl?node_id=1179832 1179832 1174130 2017-01-18 06:25:03 Noosrep Re^2: Last service name comes up empty in NMAP Parser Noosrep http://perlmonks.org/index.pl?node_id=1179831 Yeah, you're right.. Removing the /n did the trick. Unbelievable I didn't notice it right there... note Wed, 18 Jan 2017 11:23:25 +0000 http://perlmonks.org/index.pl?node_id=1179831 1179831 1174130 2017-01-18 06:23:25 Noosrep Re: Last service name comes up empty in NMAP Parser haukex http://perlmonks.org/index.pl?node_id=1179830 Hi <a href="?node=Noosrep">Noosrep</a>, my $fct_openPort = (join ',',$fct_host_obj->tcp_ports('open'))."\n" ; my @fct_ports = split ',', $fct_openPort; First of all, why fir... note Wed, 18 Jan 2017 11:16:52 +0000 http://perlmonks.org/index.pl?node_id=1179830 1179830 830549 2017-01-18 06:16:52 haukex Re^2: whats wrong with this code? purnak http://perlmonks.org/index.pl?node_id=1179829 Thanks for the answer. I think Im now close to understanding what happens.... note Wed, 18 Jan 2017 11:14:14 +0000 http://perlmonks.org/index.pl?node_id=1179829 1179829 1179811 2017-01-18 06:14:14 purnak Re: Last service name comes up empty in NMAP Parser huck http://perlmonks.org/index.pl?node_id=1179828 To me the telling thing was that the ":" for the last was on its own line.... like there was an odd "\n".... AHHAH my $fct_openPort = (join ',',$fct_host_obj->tcp_ports('open'))."\n" ; my... note Wed, 18 Jan 2017 11:11:14 +0000 http://perlmonks.org/index.pl?node_id=1179828 1179828 1175204 2017-01-18 06:11:14 huck Re^2: whats wrong with this code? purnak http://perlmonks.org/index.pl?node_id=1179827 Thanks for the answer. But so first number will always be 2 Why is that so? Shift destroys the array for good. Isnt it? ... note Wed, 18 Jan 2017 11:10:56 +0000 http://perlmonks.org/index.pl?node_id=1179827 1179827 1179811 2017-01-18 06:10:56 purnak Re^6: [Answered; thanks.] Can this be explained in layman's terms? BrowserUk http://perlmonks.org/index.pl?node_id=1179826 He just didn't expend the effort in this case. It's not that he couldn't make a much better title; he just seemed to have forgotten the importance of doing so. ... note Wed, 18 Jan 2017 11:09:20 +0000 http://perlmonks.org/index.pl?node_id=1179826 1179826 171588 2017-01-18 06:09:20 BrowserUk Re: whats wrong with this code? Marshall http://perlmonks.org/index.pl?node_id=1179824 I would code it like this (no need for the print before the loop and also swap order of statements within the loop): #!/usr/bin/perl use strict; use warnings; my @array=(1..10); while ... note Wed, 18 Jan 2017 10:40:05 +0000 http://perlmonks.org/index.pl?node_id=1179824 1179824 732669 2017-01-18 05:40:05 Marshall Re: How to optimized mysql insert into table Marshall http://perlmonks.org/index.pl?node_id=1179823 Your code is not clear at all. This looks like complete nonsense: while(){ $data .= $_; } There is no need to concatenate all of the lines into a single string. Process e... note Wed, 18 Jan 2017 10:00:09 +0000 http://perlmonks.org/index.pl?node_id=1179823 1179823 732669 2017-01-18 05:00:09 Marshall Re: whats wrong with this code? Discipulus http://perlmonks.org/index.pl?node_id=1179822 As side note nor your expectation nor your output can be as you posted: you shift before printing, so first number will always be 2. The interesting thing is that this to avoid syntax always sto... note Wed, 18 Jan 2017 09:35:34 +0000 http://perlmonks.org/index.pl?node_id=1179822 1179822 174111 2017-01-18 04:35:34 Discipulus Re^2: binding listbox with perl tkx Anonymous Monk http://perlmonks.org/index.pl?node_id=1179821 thanks that "kid" trick works fine dont know exactly what it means, but it works fine , i added a second listbox and no confusion happen... note Wed, 18 Jan 2017 09:24:39 +0000 http://perlmonks.org/index.pl?node_id=1179821 1179821 961 2017-01-18 04:24:39 Anonymous Monk Re^3: protect excel file in perl script hippo http://perlmonks.org/index.pl?node_id=1179820 Yes, of course. That's what the password field of <a href="https://metacpan.org/pod/Spreadsheet::ParseXLSX#new(%25opts)">Spreadsheet::ParseXLSX->new</a> is for.... note Wed, 18 Jan 2017 09:13:54 +0000 http://perlmonks.org/index.pl?node_id=1179820 1179820 885521 2017-01-18 04:13:54 hippo Re^2: whats wrong with this code? purnak http://perlmonks.org/index.pl?node_id=1179819 doesn't do what you want anyway I know while instead of foreach can do what I want but just wanted to know whats the problem with foreach... note Wed, 18 Jan 2017 09:03:24 +0000 http://perlmonks.org/index.pl?node_id=1179819 1179819 1179811 2017-01-18 04:03:24 purnak Re: whats wrong with this code? kcott http://perlmonks.org/index.pl?node_id=1179818 G'day <a href="?node_id=1179811">purnak</a>, Welcome to the Monastery. From "<a href="http://perldoc.perl.org/perlsyn.html#Foreach-Loops">perlsyn: Foreach Loops</a>": "If any par... note Wed, 18 Jan 2017 09:01:49 +0000 http://perlmonks.org/index.pl?node_id=1179818 1179818 861371 2017-01-18 04:01:49 kcott Re: whats wrong with this code? Corion http://perlmonks.org/index.pl?node_id=1179817 You're iterating over an array that you are modifying at the same time. This is not a recommended approach and doesn't do what you want anyway: foreach(@array){ shift (@array); ... note Wed, 18 Jan 2017 08:55:54 +0000 http://perlmonks.org/index.pl?node_id=1179817 1179817 5348 2017-01-18 03:55:54 Corion Re: Installing Perl v24 does not work! kcott http://perlmonks.org/index.pl?node_id=1179813 G'day <a href="?node_id=1179151">Wooden Shoe</a>, Welcome to the Monastery. "-bash: /.../installperl: ./perl: bad interpreter: No such file or directory" ... note Wed, 18 Jan 2017 08:47:28 +0000 http://perlmonks.org/index.pl?node_id=1179813 1179813 861371 2017-01-18 03:47:28 kcott Re^3: Win32::Process::Info and threads vr http://perlmonks.org/index.pl?node_id=1179810 This Win32::OLE hates Perl's threads too much... Then I'm afraid there's no other option but something like use strict; use warnings; use threads; use feature 'say';... note Wed, 18 Jan 2017 08:27:08 +0000 http://perlmonks.org/index.pl?node_id=1179810 1179810 1020196 2017-01-18 03:27:08 vr Re^3: DBIx or Catalyst problem: Lost connection to MySQL server during query Largo http://perlmonks.org/index.pl?node_id=1179809 The issue seems to be related to old versions of ubuntu/mysql/perl where our production servers still running on. A test with the same code and current modules on a ubuntu 16.04 ran without excepti... note Wed, 18 Jan 2017 08:19:25 +0000 http://perlmonks.org/index.pl?node_id=1179809 1179809 1179648 2017-01-18 03:19:25 Largo viddings viddings http://perlmonks.org/index.pl?node_id=1179838 user Wed, 18 Jan 2017 12:21:57 +0000 http://perlmonks.org/index.pl?node_id=1179838 1179838 1179838 2017-01-18 07:21:57 viddings Syed_sadath@Ind Syed_sadath@Ind http://perlmonks.org/index.pl?node_id=1179815 user Wed, 18 Jan 2017 08:54:29 +0000 http://perlmonks.org/index.pl?node_id=1179815 1179815 1179815 2017-01-18 03:54:29 Syed_sadath@Ind purnak purnak http://perlmonks.org/index.pl?node_id=1179811 user Wed, 18 Jan 2017 08:37:13 +0000 http://perlmonks.org/index.pl?node_id=1179811 1179811 1179811 2017-01-18 03:37:13 purnak