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-07-25 23:24:35 rss,clean Fri Jul 25 13:24:35 2014 30 20140725132435 Fri Jul 25 13:24:35 2014 http://perlmonks.org/ Anonymous Monk Sorting an hash array kepler http://perlmonks.org/index.pl?node_id=1095109 I'm trying to sort an hash array alphabetically. Here's what I'm doing: my @keys = sort { $functions{$a} $functions{$b} } keys(%functions); my @vals = @functions{@keys}; $info =... perlquestion Fri, 25 Jul 2014 22:45:56 +0000 http://perlmonks.org/index.pl?node_id=1095109 1095109 886676 2014-07-25 18:45:56 kepler Catching expressions from a file kepler http://perlmonks.org/index.pl?node_id=1095102 Hello, I'm trying to make a routine to catch some expressions from a file. I'm assuming, wrongly, that can only be one in each line... I'm capturing and appending the expressions like this: ... perlquestion Fri, 25 Jul 2014 21:31:37 +0000 http://perlmonks.org/index.pl?node_id=1095102 1095102 886676 2014-07-25 17:31:37 kepler Archive::Zip can only create zip-files in-memory, right? isync http://perlmonks.org/index.pl?node_id=1095094 Am I overseeing something? I'd like to create (possibly) large zip-files in a web-app, and from my reading of Archive::Zip, it has no means to... perlquestion Fri, 25 Jul 2014 20:39:19 +0000 http://perlmonks.org/index.pl?node_id=1095094 1095094 606015 2014-07-25 16:39:19 isync Write Matlab binary MAT-files from Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1095077 Hi guys, I'm trying to write matlab binary MAT files from Perl. Does anyone have a working routine/function that does that already? I guess I'm not the first one trying to do this...... perlquestion Fri, 25 Jul 2014 18:19:49 +0000 http://perlmonks.org/index.pl?node_id=1095077 1095077 961 2014-07-25 14:19:49 Anonymous Monk XML::Twig how to find a parent's attribute slugger415 http://perlmonks.org/index.pl?node_id=1095074 Hi Monks, quick question I couldn't find in the documentation (or didn't understand the syntax) for XML::Twig - how do I match a parent or ancestor's attribute? For instance, I have some XML: ... perlquestion Fri, 25 Jul 2014 17:53:53 +0000 http://perlmonks.org/index.pl?node_id=1095074 1095074 845976 2014-07-25 13:53:53 slugger415 Parsing a JSON response mcoblentz http://perlmonks.org/index.pl?node_id=1095073 Hello All, I am trying to parse a JSON response from a Google API and am having a bit of trouble figuring out what is the right syntax to get the correct field values.&nbsp; The program f... perlquestion Fri, 25 Jul 2014 17:46:49 +0000 http://perlmonks.org/index.pl?node_id=1095073 1095073 674384 2014-07-25 13:46:49 mcoblentz installing DBD::Sybase fionbarr http://perlmonks.org/index.pl?node_id=1095071 CPAN is telling me: Please set SYBASE in CONFIG, or set the $SYBASE enviroment variable at Makefile.PL line 120 NOTE: I am using Windows7 and usually CPAN uses DMAKE... perlquestion Fri, 25 Jul 2014 17:44:02 +0000 http://perlmonks.org/index.pl?node_id=1095071 1095071 505086 2014-07-25 13:44:02 fionbarr Re: Catching expressions from a file RonW http://perlmonks.org/index.pl?node_id=1095112 Two problems stand out to me: First: if(@Functions =~ /$expr/gi) needs to be if (grep { /$expr/i } @Functions) This will test each member of @Functio... note Fri, 25 Jul 2014 23:16:01 +0000 http://perlmonks.org/index.pl?node_id=1095112 1095112 1080444 2014-07-25 19:16:01 RonW Re^6: Write Matlab binary MAT-files from Perl (repeat) tye http://perlmonks.org/index.pl?node_id=1095111 For fixed-length formats (like 'd'), a '*' means "consume the remaining arguments". For formats that can have a length (like the ones you are trying to switch to), a '*' means "use the length of... note Fri, 25 Jul 2014 22:59:54 +0000 http://perlmonks.org/index.pl?node_id=1095111 1095111 22609 2014-07-25 18:59:54 tye Re: Sorting an hash array AppleFritter http://perlmonks.org/index.pl?node_id=1095110 Two things. &lt;=&gt; is for numerical comparison; you want the cmp operator instead. See <a href="http://perldoc.perl.org/perlop.html#Equality-Operators">Equality Operators</a>. Although you're sorting your ... note Fri, 25 Jul 2014 22:56:31 +0000 http://perlmonks.org/index.pl?node_id=1095110 1095110 1084031 2014-07-25 18:56:31 AppleFritter Re^5: Write Matlab binary MAT-files from Perl (binmode) Anonymous Monk http://perlmonks.org/index.pl?node_id=1095108 Thanks tye for your help! One last question, if you may. Now that if finally works, I'm trying to save also an array of strings instead of numbers (strings with the same length, as matl... note Fri, 25 Jul 2014 22:37:00 +0000 http://perlmonks.org/index.pl?node_id=1095108 1095108 961 2014-07-25 18:37:00 Anonymous Monk Re^2: Catching expressions from a file kepler http://perlmonks.org/index.pl?node_id=1095107 I'm very sorry - I didnt know the post didnt belong here. Kind regards, Kepler... note Fri, 25 Jul 2014 22:22:07 +0000 http://perlmonks.org/index.pl?node_id=1095107 1095107 886676 2014-07-25 18:22:07 kepler Re^2: Parsing a JSON response mcoblentz http://perlmonks.org/index.pl?node_id=1095106 I don't yet follow you but I am hanging on with everything I have. If both "address_components' AND 'types' are keys within the same hash, then what is the value pai... note Fri, 25 Jul 2014 22:20:27 +0000 http://perlmonks.org/index.pl?node_id=1095106 1095106 674384 2014-07-25 18:20:27 mcoblentz Re: Catching expressions from a file AppleFritter http://perlmonks.org/index.pl?node_id=1095105 My anonymous brother has already given you some tips on how to questions effectively, so I'll add just one thing: please, put posts in the right category. Questions about Perl and how to use it should... note Fri, 25 Jul 2014 22:13:23 +0000 http://perlmonks.org/index.pl?node_id=1095105 1095105 1084031 2014-07-25 18:13:23 AppleFritter Re: Catching expressions from a file Anonymous Monk http://perlmonks.org/index.pl?node_id=1095104 The problem is that I'm getting duplicated items in the hash. That isn't possible, hashes don't keep duplicates, they're hashes Can anyone help me out here? Not wi... note Fri, 25 Jul 2014 21:48:56 +0000 http://perlmonks.org/index.pl?node_id=1095104 1095104 961 2014-07-25 17:48:56 Anonymous Monk Re^4: Write Matlab binary MAT-files from Perl (binmode) Anonymous Monk http://perlmonks.org/index.pl?node_id=1095103 Thanks tye! I saw the link, and tried to read it. I admit it was quite intimidating at first, but actually quite simple! Thank you very much! The script works now! You've... note Fri, 25 Jul 2014 21:43:36 +0000 http://perlmonks.org/index.pl?node_id=1095103 1095103 961 2014-07-25 17:43:36 Anonymous Monk Re^5: Write Matlab binary MAT-files from Perl (link) tye http://perlmonks.org/index.pl?node_id=1095101 Did you notice that the string "binmode" was underlined and of a different color in my reply above? Did you realize that this is a visual indication that it is a link that you can click on? Did... note Fri, 25 Jul 2014 21:26:25 +0000 http://perlmonks.org/index.pl?node_id=1095101 1095101 22609 2014-07-25 17:26:25 tye Re^4: Write Matlab binary MAT-files from Perl (binmode) Anonymous Monk http://perlmonks.org/index.pl?node_id=1095100 Thanks tye, but excuse my ignorence, how do I use the binmode...? I've attached below the 'mat4_write' code. Where should I tell it to use the binmode...? ... note Fri, 25 Jul 2014 21:23:16 +0000 http://perlmonks.org/index.pl?node_id=1095100 1095100 961 2014-07-25 17:23:16 Anonymous Monk Re^3: Write Matlab binary MAT-files from Perl (binmode) tye http://perlmonks.org/index.pl?node_id=1095099 You need <a href="http://perldoc.perl.org/functions/binmode.html">binmode</a>. - <a href="?node=tye">tye</a> &nbsp; &nbsp; &nbsp; &nbsp; ... note Fri, 25 Jul 2014 21:11:59 +0000 http://perlmonks.org/index.pl?node_id=1095099 1095099 22609 2014-07-25 17:11:59 tye Re^2: Write Matlab binary MAT-files from Perl (which byte) Anonymous Monk http://perlmonks.org/index.pl?node_id=1095098 Hi tye, Thanks! I have no problem sharing the byte's offset, I have nothing to hide :) It looks like it's the 9th byte (Byte 8 starting from 0). It has the value 0x0D and ... note Fri, 25 Jul 2014 21:10:18 +0000 http://perlmonks.org/index.pl?node_id=1095098 1095098 961 2014-07-25 17:10:18 Anonymous Monk Re^4: CPAN Module Installation (aka Oh, God, Here We Go Again) marto http://perlmonks.org/index.pl?node_id=1095097 "Everyone who finds it trivial to find, download, install, initialize and test required, but unfamiliar utilities on their new windows computer already has strawberry perl!" Sorry, I... note Fri, 25 Jul 2014 20:51:34 +0000 http://perlmonks.org/index.pl?node_id=1095097 1095097 324763 2014-07-25 16:51:34 marto Re^3: CPAN Module Installation (aka Oh, God, Here We Go Again) BillKSmith http://perlmonks.org/index.pl?node_id=1095096 Everyone who finds it trivial to find, download, install, initialize and test required, but unfamiliar utilities on their new windows computer already has strawberry perl! Everyone else weighs the ad... note Fri, 25 Jul 2014 20:47:14 +0000 http://perlmonks.org/index.pl?node_id=1095096 1095096 957973 2014-07-25 16:47:14 BillKSmith Re: Archive::Zip can only create zip-files in-memory, right? Your Mother http://perlmonks.org/index.pl?node_id=1095095 HURR? From the Pod: $zip->writeToFileNamed('someZip.zip'). ... note Fri, 25 Jul 2014 20:46:43 +0000 http://perlmonks.org/index.pl?node_id=1095095 1095095 248054 2014-07-25 16:46:43 Your Mother Re^3: Matching/replacing a unicode character only works after decode() Anonymous Monk http://perlmonks.org/index.pl?node_id=1095093 Christiansen also once published a Yes/No style table of all the languages and Perl was by far the best among Java/Python/Ruby/PHP. Iím sorry I could not find this table again to link. ... note Fri, 25 Jul 2014 20:15:27 +0000 http://perlmonks.org/index.pl?node_id=1095093 1095093 961 2014-07-25 16:15:27 Anonymous Monk Re^11: Convertion Perl Script to Exe with PAR::Packer pp marchiore http://perlmonks.org/index.pl?node_id=1095092 Yes, i created a folder containing the file and in the script i got it with: "$ENV{HOMEDRIVE}" . "\\JOFA\\jofalista.xlsx" Much more easier than i think. Thanks again!... note Fri, 25 Jul 2014 20:13:02 +0000 http://perlmonks.org/index.pl?node_id=1095092 1095092 1094956 2014-07-25 16:13:02 marchiore Re^10: Convertion Perl Script to Exe with PAR::Packer pp RonW http://perlmonks.org/index.pl?node_id=1095091 So, just putting the xlsx file in C:\? (On Win7, HOMEDRIVE is almost always C:\. Sometimes D:\, E:\ or other, but always just a drive letter.) (Maybe I'm... note Fri, 25 Jul 2014 20:02:15 +0000 http://perlmonks.org/index.pl?node_id=1095091 1095091 1080444 2014-07-25 16:02:15 RonW Re: Write Matlab binary MAT-files from Perl (which byte) tye http://perlmonks.org/index.pl?node_id=1095090 I saw they differ in 1 additional byte... And you don't want to share what that byte's value and offset were? Maybe even which file had the extra byte? That i... note Fri, 25 Jul 2014 20:02:11 +0000 http://perlmonks.org/index.pl?node_id=1095090 1095090 22609 2014-07-25 16:02:11 tye Re^2: Parsing a JSON response GrandFather http://perlmonks.org/index.pl?node_id=1095089 Note that that can be written: $VAR1->{address_components}<a href="?node=4">4</a>{long_name} which is more consistent with the OP's usage and reads better (at least to my eye) because it reduces cl... note Fri, 25 Jul 2014 19:55:15 +0000 http://perlmonks.org/index.pl?node_id=1095089 1095089 461912 2014-07-25 15:55:15 GrandFather Re: Tk::BrowseEntry set function -solved glenn http://perlmonks.org/index.pl?node_id=1095088 #!/usr/bin/perl use Tk; use Tk::BrowseEntry; use strict; my $mw = MainWindow->new(); my $hddSel = $mw->BrowseEntry()->pack; foreach my $c (1..50) { $hddSel->insert("end",$c); }... note Fri, 25 Jul 2014 19:44:25 +0000 http://perlmonks.org/index.pl?node_id=1095088 1095088 717761 2014-07-25 15:44:25 glenn Re^2: Parsing a JSON response mcoblentz http://perlmonks.org/index.pl?node_id=1095087 Yes, thanks for the correction - I'm just parsing the data structure created by the module - I'm not doing it myself. And thanks for the tip on the structures as the positions are indeed not immu... note Fri, 25 Jul 2014 19:30:40 +0000 http://perlmonks.org/index.pl?node_id=1095087 1095087 674384 2014-07-25 15:30:40 mcoblentz Re^2: Write Matlab binary MAT-files from Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1095086 FWIW, <a href="https://metacpan.org/module/Data%3A%3AMATFile">Data::MATFile</a> does reading with unpack ... its clues at least :)... note Fri, 25 Jul 2014 19:02:31 +0000 http://perlmonks.org/index.pl?node_id=1095086 1095086 961 2014-07-25 15:02:31 Anonymous Monk Re: Subroutine & For loop Laurent_R http://perlmonks.org/index.pl?node_id=1095085 A oneliner example: $ perl -e 'for my $c (1..10) {print_square($c)}; sub print_square{my $d = shift; print $d*$d, "\n";}' 1 4 9 16 25 36 49 64 81 100 ... note Fri, 25 Jul 2014 18:58:19 +0000 http://perlmonks.org/index.pl?node_id=1095085 1095085 992570 2014-07-25 14:58:19 Laurent_R Re: XML::Twig how to find a parent's attribute poj http://perlmonks.org/index.pl?node_id=1095084 $elt->parent('p<a href="?node=%40conref%20%21%3D%20%22%22">@conref != &quot;&quot;</a>') #!perl use strict; use XML::Twig; my $xml = do { local $/; }; my $twig = new XML::Twig( twig_handlers =>{ li => \&li}, ); ... note Fri, 25 Jul 2014 18:55:56 +0000 http://perlmonks.org/index.pl?node_id=1095084 1095084 221725 2014-07-25 14:55:56 poj Re: Parsing a JSON response Your Mother http://perlmonks.org/index.pl?node_id=1095083 To clarify, you are not parsing a JSON response, you are using a Perl data structure returned by the module. There no JSON handling in your code and itís irrelevant to what youíre doing whet... note Fri, 25 Jul 2014 18:43:57 +0000 http://perlmonks.org/index.pl?node_id=1095083 1095083 248054 2014-07-25 14:43:57 Your Mother Re^2: installing DBD::Sybase fionbarr http://perlmonks.org/index.pl?node_id=1095082 thanks....I got the same error message.... set the $SYBASE environment variable set it to what? 'SET $SYBASE=c:\sybase' ??... note Fri, 25 Jul 2014 18:35:21 +0000 http://perlmonks.org/index.pl?node_id=1095082 1095082 505086 2014-07-25 14:35:21 fionbarr Re: XML::Twig how to find a parent's attribute AppleFritter http://perlmonks.org/index.pl?node_id=1095081 Looking at <a href="http://search.cpan.org/perldoc?XML%3A%3ATwig">XML::Twig</a>'s source, you can apparently pass subroutine references, regular expressions, or plain strings (which can themselves be used in various ways to express different things). ... note Fri, 25 Jul 2014 18:34:17 +0000 http://perlmonks.org/index.pl?node_id=1095081 1095081 1084031 2014-07-25 14:34:17 AppleFritter Re: Write Matlab binary MAT-files from Perl AppleFritter http://perlmonks.org/index.pl?node_id=1095080 I have never used the 'pack' function, and the help from the link below is hard to follow: http://perldoc.perl.org/functions/pack.html I couldn't find a match there for... note Fri, 25 Jul 2014 18:28:42 +0000 http://perlmonks.org/index.pl?node_id=1095080 1095080 1084031 2014-07-25 14:28:42 AppleFritter Re^2: Parsing a JSON response mcoblentz http://perlmonks.org/index.pl?node_id=1095079 Ah, enlightenment. I kept trying things like {type<a href="?node=4">4</a>} but that wasn't getting me anywhere. Thank you!... note Fri, 25 Jul 2014 18:24:57 +0000 http://perlmonks.org/index.pl?node_id=1095079 1095079 674384 2014-07-25 14:24:57 mcoblentz Re: installing DBD::Sybase AppleFritter http://perlmonks.org/index.pl?node_id=1095078 Not really an answer to your question, but merely a pointer: a very similar question was just asked in <a href="?node_id=1095037">I am not able to install DBD::Sybase module using cpan on windows as well as Ubuntu</a>; it may be worthwhile following replies on that node as well.... note Fri, 25 Jul 2014 18:23:35 +0000 http://perlmonks.org/index.pl?node_id=1095078 1095078 1084031 2014-07-25 14:23:35 AppleFritter Re: Parsing a JSON response wjw http://perlmonks.org/index.pl?node_id=1095076 $VAR1->{'address_components'}-><a href="?node=4">4</a>->{'long_name'} works for me... Hope that helps.... Update:I think that you are seeing {'address_components'} as part of the 'ty... note Fri, 25 Jul 2014 18:19:33 +0000 http://perlmonks.org/index.pl?node_id=1095076 1095076 310300 2014-07-25 14:19:33 wjw Re^9: Convertion Perl Script to Exe with PAR::Packer pp marchiore http://perlmonks.org/index.pl?node_id=1095075 great ideia, i solved it using this solution but using $ENV{HOMEDRIVE} Ty very much!!! ... note Fri, 25 Jul 2014 18:16:12 +0000 http://perlmonks.org/index.pl?node_id=1095075 1095075 1094956 2014-07-25 14:16:12 marchiore Re^2: Storing part of a regex in a variable Anonymous Monk http://perlmonks.org/index.pl?node_id=1095072 Correction: it looks like this (?^x:((?^:(? \w+ (I also forgot x :) Also, you may find this useful: &#91;http://stackoverflow.com/questions/4231382/regular-e... note Fri, 25 Jul 2014 17:45:44 +0000 http://perlmonks.org/index.pl?node_id=1095072 1095072 961 2014-07-25 13:45:44 Anonymous Monk Re: Storing part of a regex in a variable Anonymous Monk http://perlmonks.org/index.pl?node_id=1095070 Could the problem be that my $identifier variable itself includes the $brackets variable? Do I need to eval it or something to force it to interpolate it correctly? No... note Fri, 25 Jul 2014 17:30:05 +0000 http://perlmonks.org/index.pl?node_id=1095070 1095070 961 2014-07-25 13:30:05 Anonymous Monk Re^3: connect string for sybase Corion http://perlmonks.org/index.pl?node_id=1095069 Usually, $ENV{SYBASE} is set to the directory where your Sybase client libraries are installed. Maybe you can set $ENV{SYBASE} to that directory?... note Fri, 25 Jul 2014 17:27:28 +0000 http://perlmonks.org/index.pl?node_id=1095069 1095069 5348 2014-07-25 13:27:28 Corion Re^10: Convertion Perl Script to Exe with PAR::Packer pp Corion http://perlmonks.org/index.pl?node_id=1095068 This is weird. This means that <a href="http://search.cpan.org/perldoc?PAR%3A%3AEnvironment">PAR::Environment</a> is inaccurate. I don't know how to help further - most likely, you have to dump %ENV and see what is in there once your progra... note Fri, 25 Jul 2014 17:26:14 +0000 http://perlmonks.org/index.pl?node_id=1095068 1095068 5348 2014-07-25 13:26:14 Corion