|
I have a question. I have a filehandle I'm printing to:code:
Edit: thinking about this some more, is there a way to do something like if a user does CTRL-C or if there is an abrupt end or big error, can the program say "on exit, close this file handle?" mister_gosh fucked around with this message at 14:06 on Dec 7, 2007 |
# ¿ Dec 7, 2007 13:38 |
|
|
# ¿ May 1, 2024 09:25 |
|
Triple Tech posted:Two things. One, it sounds like what you're asking for is to output to a file as soon as possible. That is achieved by the following: Thanks, this is invaluable stuff!
|
# ¿ Dec 7, 2007 16:23 |
|
I have a problem with encoding. The resulting file must be UTF-8. I am opening a file handle, doing something with each line and then printing it out. code:
Other times, that makes things worse because it is already in utf8. Is there a way to test if the line is already utf8? I think I need a good encode tutorial.
|
# ¿ Jan 25, 2008 21:09 |
|
What does the extra dollar sign mean in a variable? For example: $$variableName
|
# ¿ Jan 27, 2008 21:31 |
|
How can I NOT store the path for the files I put in a zip archive? In other words, when you open the zip file, each file has a path of abc/def (see $myDir below). I don't want a user extracting the zip and having it generate the directories abc/def. I just want it to extract to a directory equaling the filename of the zip. For what it's worth, here's the code- code:
|
# ¿ Jun 19, 2008 02:35 |
|
fansipans posted:Which is funny, because I already had those two URLs open in my browser Haha, thanks guys! I saw the new name parameter but dismissed it immediately because I wanted the name to be the same in the zip file (duh!)...I hadn't considered that the filename I was passing in was the full name, it makes sense now.
|
# ¿ Jun 19, 2008 14:28 |
|
I have an incredibly basic Perl and IO stuff in general question. I have a database related app that takes about 4 minutes to run. While it does so, it some known variable values to the screen. I just ran this same program but told it to not print the messages and it took only 2 minutes. Nothing is different. The same variables are being collected. The only difference is I am not executing the print statements. What the heck? Does it really take half of the time to print my variables? I'm not sure how much data is sent to the screen during one submission, but I would guess 2MB at most.
|
# ¿ Nov 17, 2008 22:51 |
|
I am retrieving a path from an external source and now have a string: C:\Program Files\Foo Bar Baz\bin I need to shorten it like so: C:\Progra~1\Foo Ba~1\bin Any idea how I can do this with the least amount of packages?
|
# ¿ Jan 16, 2009 02:08 |
|
Triple Tech posted:GetShortPathName from Win32 Works great, thanks!
|
# ¿ Jan 16, 2009 02:39 |
|
I have a long line with thousands of characters. I want to find each occurrence of the string abc(\d+) and do something with it. For example, I may have: abc123 blah blah abc456 blah blah abc789 blah What's the best way to attempt this? Futile attempt: code:
|
# ¿ Feb 17, 2009 01:28 |
|
^^^^ Thanks!!!! vvvv
mister_gosh fucked around with this message at 02:13 on Feb 17, 2009 |
# ¿ Feb 17, 2009 01:44 |
|
I'm setting up a bunch of client machines with some custom programs. Most are working except one. I'm getting the error:code:
|
# ¿ Jun 3, 2010 15:00 |
|
Wow, so this is how the PERL5LIB was defined:code:
Thanks guys!
|
# ¿ Jun 3, 2010 15:37 |
|
This code is printing, simply "Error: 18":code:
|
# ¿ Jun 11, 2010 02:26 |
|
Right but what would "18" be? I should mention that this used to work fine, but there has been some upgrades of multiple components. The process I am calling as well as Perl going from 5.8.3 to 5.10.0. Is it possible that an older version of Win32 is being called? I really doubt this.
|
# ¿ Jun 11, 2010 12:55 |
|
Thank you!! I had tried googling but my search was too refined, I think. Not sure what it means because the process finishes successfully but at least it's better than 18.
|
# ¿ Jun 11, 2010 14:03 |
|
It seems that 5.10 (was working fine in 5.8.3) introduced some extra tainting security on looking up environment variables. At least I think that is the problem but I'm not quite clear on how to fix it. Google only mentions the "PATH" variable and it appears they have some hard-coding in the solution, which isn't making sense to me. This used to work: my $myVar = $ENV{'MYVAR'}; # typically this would be "D:\mypath\myfile" but it could be anything Now it is just a blank value. Edit: its a USER variable, moved it to SYSTEM and it works fine. Not sure what is different now. mister_gosh fucked around with this message at 21:42 on Jun 11, 2010 |
# ¿ Jun 11, 2010 16:54 |
|
Are there any considerations to make with this script on W7? It works fine on my XP machine but does not work in W7 on a particular machine. The permissions appear to be open for the user (I believe they are an admin, in fact): code:
|
# ¿ Dec 15, 2010 15:53 |
|
The Gate of Nanna posted:What distribution of Perl are you using for Windows? ActiveState? Strawberry? It is activestate 5.10.0 I'll have the user try that. Thanks!
|
# ¿ Dec 15, 2010 17:09 |
|
How can I print the current package or program name? Pseudo code: code:
|
# ¿ May 17, 2011 17:12 |
|
qntm posted:That is actually almost it. Thanks! That makes googling for it easier (left my Perl in a Nutshell book in the wrong location today.
|
# ¿ May 17, 2011 17:56 |
|
I have a requirement to replace characters in a given string so that it only contains A-Za-z0-9.-_ Can anyone point me in the right direction? Thanks in advance! code:
|
# ¿ Jan 20, 2012 17:07 |
|
Wow, thank you. I thought it was going to be much more complicated (substrings, looping, etc.). I switch between too many languages (the worst, of which, is XSLT). Thanks!
|
# ¿ Jan 20, 2012 17:29 |
|
|
# ¿ May 1, 2024 09:25 |
|
Is there a case-sensitive method to test for file existence? For example, if I have a file named C:/Abc.txt, then I want "it does not exist" to print: code:
|
# ¿ Jun 12, 2014 19:28 |