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 2015-09-02 00:57:16 rss,clean Tue Sep 1 14:57:16 2015 30 20150901145716 Tue Sep 1 14:57:16 2015 http://perlmonks.org/ Anonymous Monk Parsing text string in Perl gbwien http://perlmonks.org/index.pl?node_id=1140723 Hi, I am trying to get back into Perl and I have a question regarding how best to parse the following I have a file which contains many of the following entries Time: 1/9... perlquestion Tue, 01 Sep 2015 21:48:19 +0000 http://perlmonks.org/index.pl?node_id=1140723 1140723 1140720 2015-09-01 17:48:19 gbwien Problems with PDF::API2 and TextBlock dougconran http://perlmonks.org/index.pl?node_id=1140722 I have an application that uses PDF::API2 (amogst other things to display jpg images) and PDF::TextBlock which has been running without problems on perl5.10.1. However I've just (foolishly, probably... perlquestion Tue, 01 Sep 2015 21:41:01 +0000 http://perlmonks.org/index.pl?node_id=1140722 1140722 895445 2015-09-01 17:41:01 dougconran Processing spreadsheet with some cells in ASCII, other cells in UTF-8 Amphiaraus http://perlmonks.org/index.pl?node_id=1140714 I am writing a Perl program which takes input from a column in an Excel spreadsheet listing names of European cars. This column is named "MenuList". The names of European cars often contain lette... perlquestion Tue, 01 Sep 2015 20:43:45 +0000 http://perlmonks.org/index.pl?node_id=1140714 1140714 706583 2015-09-01 16:43:45 Amphiaraus Re^4: For loop not executing all the values Anonymous Monk http://perlmonks.org/index.pl?node_id=1140738 GrandFather: Hmm, that looks like cargo culting on my part. I Maybe you were memeing? :D <a href="?node_id=303987">To Kill a Meme: while(defined($line = ))</a>... note Wed, 02 Sep 2015 00:41:12 +0000 http://perlmonks.org/index.pl?node_id=1140738 1140738 961 2015-09-01 20:41:12 Anonymous Monk Re^3: For loop not executing all the values GrandFather http://perlmonks.org/index.pl?node_id=1140737 Hmm, that looks like cargo culting on my part. I had the impression that in the past the explicit assignment broke the special handling for in while loop expressions. A quick look through the Pe... note Wed, 02 Sep 2015 00:35:56 +0000 http://perlmonks.org/index.pl?node_id=1140737 1140737 461912 2015-09-01 20:35:56 GrandFather Re^4: My preferred temperature scale is: Anonymous Monk http://perlmonks.org/index.pl?node_id=1140736 my digital dashboard display lets me choose between miles or km ... so all the same size, but still hard to see ( 90s green LCD not bright)... note Wed, 02 Sep 2015 00:33:36 +0000 http://perlmonks.org/index.pl?node_id=1140736 1140736 961 2015-09-01 20:33:36 Anonymous Monk Re: help to write perl code Anonymous Monk http://perlmonks.org/index.pl?node_id=1140735 Please mark your updates , thank you. <a href="?node_id=17557">How do I change/delete my post?</a> Also , if I were you, I would adapt <a href="?node_id=1140595">Re^2: HELP TO WRITE THE PERL CODE</a> to take @id into account (like where the bit goes) ... note Wed, 02 Sep 2015 00:29:37 +0000 http://perlmonks.org/index.pl?node_id=1140735 1140735 961 2015-09-01 20:29:37 Anonymous Monk Re: PDF::API2 module prints junk characters ( CAM::PDF / pdfinfo.pl) Anonymous Monk http://perlmonks.org/index.pl?node_id=1140734 Apparently, PDF::API2 is for creating PDFs, it will read them, but a lot of the fields/records will just be binary junk ... which you can replace with various calls What you're after is &#91;meta... note Wed, 02 Sep 2015 00:17:51 +0000 http://perlmonks.org/index.pl?node_id=1140734 1140734 961 2015-09-01 20:17:51 Anonymous Monk Re^2: My preferred temperature scale is: Anonymous Monk http://perlmonks.org/index.pl?node_id=1140733 -40C = 233.15K and -40F = 233.15K Chuckle with <a href="?node=tye">tye</a>... and at unnamed (cold weather?) scientist.... note Wed, 02 Sep 2015 00:11:20 +0000 http://perlmonks.org/index.pl?node_id=1140733 1140733 961 2015-09-01 20:11:20 Anonymous Monk Re: My preferred temperature scale is: tye http://perlmonks.org/index.pl?node_id=1140732 I still recall watching some science/nature program where a scientist is talking about the extreme conditions they had to deal with and says it was "minus 40 degrees" and then, after a short paus... note Tue, 01 Sep 2015 23:46:41 +0000 http://perlmonks.org/index.pl?node_id=1140732 1140732 22609 2015-09-01 19:46:41 tye Re^4: how to change this code into perl perlnewbie012215 http://perlmonks.org/index.pl?node_id=1140729 Hi Laurent_R, That was my bad, I had hidden characters in it, thats why I did not work. Your script is working...thank you so much for helping me and explaining it..... note Tue, 01 Sep 2015 22:39:13 +0000 http://perlmonks.org/index.pl?node_id=1140729 1140729 1114203 2015-09-01 18:39:13 perlnewbie012215 Re^2: calling sub with object as param Anonymous Monk http://perlmonks.org/index.pl?node_id=1140728 I think the OP isn't handling the class name as the first parameter in the method.... note Tue, 01 Sep 2015 22:39:04 +0000 http://perlmonks.org/index.pl?node_id=1140728 1140728 961 2015-09-01 18:39:04 Anonymous Monk Re: Problems with PDF::API2 and TextBlock stevieb http://perlmonks.org/index.pl?node_id=1140727 Can you post your base doc along with the code you have? It's the only way we'll be able to try to replicate your issues. I took a look through the bugs and Changes files for both ... note Tue, 01 Sep 2015 22:30:02 +0000 http://perlmonks.org/index.pl?node_id=1140727 1140727 789891 2015-09-01 18:30:02 stevieb Re: Parsing text string in Perl BrowserUk http://perlmonks.org/index.pl?node_id=1140726 Something like this?: #! perl -slw use strict; $/ = 'Time:'; while( ) { chomp; m<a href="?node=%5Cs%2B%28%5CS%2B%29.%2B%3FESME_RTHROTTLED">\s+(\S+).+?ESME_RTHROTTLED</a> and print "Time:", $_;... note Tue, 01 Sep 2015 22:18:23 +0000 http://perlmonks.org/index.pl?node_id=1140726 1140726 171588 2015-09-01 18:18:23 BrowserUk Re: Parsing text string in Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1140725 Tom Does the header 'Time:' always begin each record? If so, you can set the record delimiter, $/, to the value 'Time:' and then, { local $/ = 'Time:'; while(... note Tue, 01 Sep 2015 22:17:40 +0000 http://perlmonks.org/index.pl?node_id=1140725 1140725 961 2015-09-01 18:17:40 Anonymous Monk Re: Parsing text string in Perl 1nickt http://perlmonks.org/index.pl?node_id=1140724 It depends on what you have for"record" delimiters. If the first line is always the time, you could store that in a variable and print it out if you hit your token before the next record starts, or re... note Tue, 01 Sep 2015 22:14:38 +0000 http://perlmonks.org/index.pl?node_id=1140724 1140724 1130276 2015-09-01 18:14:38 1nickt Re: Digest::MD5 addfile() w/ tied filehandle jdv http://perlmonks.org/index.pl?node_id=1140719 Following the suggestion of BrowserUk, I tried to write a bare-minimum example of this behavior. The code is below. The TieTest class is basically meant to remember an internal filehandle and then ... note Tue, 01 Sep 2015 21:18:13 +0000 http://perlmonks.org/index.pl?node_id=1140719 1140719 1119257 2015-09-01 17:18:13 jdv Re: Processing spreadsheet with some cells in ASCII, other cells in UTF-8 tangent http://perlmonks.org/index.pl?node_id=1140718 These garbled strings are accompanied by the error message "Wide character in print" How are you opening the .ini file for output - try this if not already: ... note Tue, 01 Sep 2015 21:04:46 +0000 http://perlmonks.org/index.pl?node_id=1140718 1140718 905403 2015-09-01 17:04:46 tangent Re: My preferred temperature scale is: vitoco http://perlmonks.org/index.pl?node_id=1140717 Celcius is the scale used in my country, but the thermostat of the air conditioner system at home failed, and the only replacement piece available for that model was in Fahrenheit. I had to print a... note Tue, 01 Sep 2015 21:01:02 +0000 http://perlmonks.org/index.pl?node_id=1140717 1140717 763880 2015-09-01 17:01:02 vitoco Re: Processing spreadsheet with some cells in ASCII, other cells in UTF-8 stevieb http://perlmonks.org/index.pl?node_id=1140716 This is my first ever attempt at non-ascii processing, so I'll let the more experienced Monks criticize if this is the wrong approach, or if there's a better one. After a very quick dig o... note Tue, 01 Sep 2015 20:57:28 +0000 http://perlmonks.org/index.pl?node_id=1140716 1140716 789891 2015-09-01 16:57:28 stevieb Re: Processing spreadsheet with some cells in ASCII, other cells in UTF-8 1nickt http://perlmonks.org/index.pl?node_id=1140715 I think you are confused about encoding. See <a href="http://perldoc.perl.org/perlunitut.html">perlunitut</a>. #!/usr/bin/perl use strict; use warnings; use feature qw/ say /; use Encode qw/encode decode/; my $dreamcar = 'Lotus Élan'... note Tue, 01 Sep 2015 20:55:01 +0000 http://perlmonks.org/index.pl?node_id=1140715 1140715 1130276 2015-09-01 16:55:01 1nickt Re^4: Digest::MD5 addfile() w/ tied filehandle BrowserUk http://perlmonks.org/index.pl?node_id=1140711 If I see the same thing, does this seem like a bug or a feature request? Would they both go to the same place? My best guess based upon what I've read in this th... note Tue, 01 Sep 2015 19:46:03 +0000 http://perlmonks.org/index.pl?node_id=1140711 1140711 171588 2015-09-01 15:46:03 BrowserUk Re^3: Digest::MD5 addfile() w/ tied filehandle jdv http://perlmonks.org/index.pl?node_id=1140710 1. The actual filehandle to the compressed file my class reads is opened ':raw', yes. I'm not sure where else it would make sense to do this. If I try to binmode the tied filehandle, it just tries ... note Tue, 01 Sep 2015 19:07:10 +0000 http://perlmonks.org/index.pl?node_id=1140710 1140710 1119257 2015-09-01 15:07:10 jdv ajoliveira ajoliveira http://perlmonks.org/index.pl?node_id=1140730 user Tue, 01 Sep 2015 23:31:34 +0000 http://perlmonks.org/index.pl?node_id=1140730 1140730 1140730 2015-09-01 19:31:34 ajoliveira gbwien gbwien http://perlmonks.org/index.pl?node_id=1140720 user Tue, 01 Sep 2015 21:40:05 +0000 http://perlmonks.org/index.pl?node_id=1140720 1140720 1140720 2015-09-01 17:40:05 gbwien dhganga9 dhganga9 http://perlmonks.org/index.pl?node_id=1140712 user Tue, 01 Sep 2015 20:06:53 +0000 http://perlmonks.org/index.pl?node_id=1140712 1140712 1140712 2015-09-01 16:06:53 dhganga9