|
Hughmoris posted:After trying to understand referencing/dereferencing a little more (I still don't really get it) Hughmoris posted:I'm using Strawberry Perl, v5.20.1
|
# ¿ Apr 6, 2015 20:59 |
|
|
# ¿ May 2, 2024 12:17 |
|
Ephphatha posted:Is there a "say" equivalent that prints to STDERR? I've got a few scripts that I print warnings out to highlight bad data (so there's no need for line numbers) and remembering to put \n on the end of each string is a drag.
|
# ¿ Apr 7, 2015 07:02 |
|
This should definitely go in the Coding Horrors thread.
|
# ¿ Apr 9, 2015 04:28 |
|
Salt Fish posted:Im bad but you could wget or curl and pipe the output into your script as standard in via a cron.
|
# ¿ Apr 10, 2015 22:30 |
|
Hughmoris posted:Thanks. I don't know if I'll even get that far as I can't successfully install Dancer2. On ubuntu, using the command "CPAN install dancer2" will do some processes and eventually display "Running Build install
|
# ¿ May 9, 2015 05:40 |
|
Hughmoris posted:Lots and lots.
|
# ¿ May 13, 2015 17:17 |
|
Hughmoris posted:I'm pretty unfamiliar with how modules are installed but it seemed like everything failed. Unfortunately I didn't save a copy of the log before I fixed the problem so I can only give vague answers
|
# ¿ May 13, 2015 18:13 |
|
Mithaldu posted:Just in case Blotto's post didn't make it more clear (though i'm unclear how saying "it's an alias" is not clear enough): The advantage to for is four letters less to type AND less to read for developers who come after you, since aside from the letters "each", for and foreach are literally the same thing. They're different names that result in identical code.
|
# ¿ May 19, 2015 03:07 |
|
Hughmoris posted:Well, I may have spoke too soon. I think I'm getting hung up on dereferencing. I have a block of code that looks something like this: code:
|
# ¿ Aug 13, 2015 09:17 |
|
Mithaldu posted:You mean: code:
|
# ¿ Aug 13, 2015 21:51 |
|
Mithaldu posted:A true perler would've known to use a comma there, i'm going to have to confiscate your card. code:
|
# ¿ Aug 13, 2015 22:37 |
|
Mithaldu posted:A true perler also has a sense of humor.
|
# ¿ Aug 13, 2015 23:29 |
|
welcome to hell posted:Even among the IRC crowd you aren't going to see a lot of consistency on style preferences for minor things like this.
|
# ¿ Aug 14, 2015 03:23 |
|
Hughmoris posted:Speaking of barcodes, does anyone have experience using Perl to generate barcodes? I'm tackling a project at work where the goal is to take a text file that contains a Name and Account Number, and to generate a tiff image that contains the Name, the Account Number, and a barcode (generated from the Account Number). code:
|
# ¿ Aug 15, 2015 21:27 |
|
Hughmoris posted:Thanks, the PDF::ReportWriter looks promising. If ReportWriter doesn't quite fit your needs, it's PDF::API2 does all the heavy lifting and allows for more granularity. Keep in mind, though, that in PDFs, 0,0 is the bottom left. Also, you'll probably have to factor in the ascender/descender of the font. PDF can be a pain in the rear end.
|
# ¿ Aug 16, 2015 03:47 |
|
Hughmoris posted:I'm on the tail end of a work project, and am a bit stumped on what should be the easiest part.
|
# ¿ Aug 28, 2015 06:24 |
|
Hughmoris posted:I don't have control of the target machine but I'm being told no, it doesn't have SSH. I want to say it runs some version of Windows Server, and the Perl script will be running on a Windows 7 computer running Strawberry Perl.
|
# ¿ Aug 29, 2015 01:33 |
|
Mithaldu posted:(in particular Ruby's OO is extremely barebones compared to Perl's) code:
Extortionist posted:Perl's flexibility is a huge handicap against learning (yes, I am arguing that the issue here is something inherent to perl). I don't think it has much to do with the laziness you imply, so much as it has to do with the difficulty of learning various concepts and perl's willingness to let you put together something that entirely contradicts best practices but also solves the problem you're trying to solve (this is probably also one of perl's biggest strengths--just not so much when it comes to learning). I deal with the consequences of this too often in my daily work to assume that someone trying to learn something blindly in such a permissive language will magically fall into best practices. Surely someone can do it if they're smart and diligent enough--but probably they'd also have an easier time of it if the language didn't fool them about what they were doing. While I've coded in perl for about 17 years, it's not a good starter language. [edit] Perl 6 [edit2] Mithaldu, are you that "true perler" guy from a few months back? Ellie Crabcakes fucked around with this message at 08:17 on Feb 23, 2016 |
# ¿ Feb 23, 2016 08:01 |
|
Mithaldu posted:Particularly attribute and constructor declaration in Ruby are barely more detailed than those in core Perl. Because perl just can't do it off of a base install. If it could, Moo and Moose and Class::C3 and all of the other bolt-ons would be totally unnecessary. Now if you're not actually a ridiculous perl bigot, I apologize, but you kinda come off as one. Especially when you say a from-the-ground-up OO language is barebones compared to perl. Do you have any experience with any actual OO language?
|
# ¿ Feb 24, 2016 04:30 |
|
Seems like a good learning project. I'd recommend AnyEvent for listening to the stream.
|
# ¿ Apr 20, 2016 05:49 |
|
octobernight posted:I'm working with large 200-500 Gb text files, and I want to find lines that match a pre-defined list line ids and return the next line following the match. Here's my starting code: 1) It won't match the ids unless you chomp the line first. 2)defined $ids{foo} is always going to return false because the value of $id{foo} is set to undef. What you want is exists $id{foo} Unless the id line and the content line have fixed widths--and I imagine they do not--then threads aren't going to help. First off, you won't know how many threads to spawn because you have to read through the entire file to get a line count. Then, each thread is going to have to read lines and throw them away until they get to their starting point.
|
# ¿ Aug 2, 2016 03:44 |
|
|
# ¿ May 2, 2024 12:17 |
|
octobernight posted:Thanks! I meant to use exists, not defined, and I left out the code that trims the lines so that all whitespace is removed from the ends. I wasn't planning on start exactly at a particular line, rather I was going to jump to XXXX byte location for each thread. I would then throw away whatever line it read it and find the first complete line that has the line start identifier (in my file, the id format is $id). It was something off the top of my head, though. Instead of having the threads jump in at a random location and discard lines, stat the fil and, divide the size by the number of threads. Seek to $chunksize*$i, read until $ preceded by a newline. Feed those offsets into the worker threads and you won't have to discard any lines and the almost-guaranteed mangled data resulting therefrom. That said, this whole setup seems a lot less than ideal. What sort of data is in these files and how are they generated? What happens to the data pulled out?
|
# ¿ Aug 3, 2016 01:40 |