This is more out of curiosity than anything else, as I'm failing to find any useful info on Google about this function (CORE::substcont)
In profiling and optimising some old, slow, XML parsing code I've found that the following regex is calling substcont 31 times for each time the line is executed, and taking a huge amount of time:
...
In Perl most of my print statements take the form
print "hello." . "\n";
Is there a nice way to avoid keeping all the pesky "\n"s lying around?
I know I could make a new function such as myprint that automatically appends \n, but it would be nice if I could override the existing print.
...
I'm looking for a way of mapping a uid (unique number representing a system user) to a user name using Perl.
Please don't suggest greping /etc/passwd :)
Edit
As a clarification, I wasn't looking for a solution that involved reading /etc/passwd explicitly. I realize that under the hood any solution would end up doing this, but I was se...
OK, I'm probably just having a bad Monday, but I have the following need and I'm seeing lots of partial solutions but I'm sure I'm not the first person to need this, so I'm wondering if I'm missing the obvious.
$client has 50 to 500 bytes worth of binary data that must be inserted into the middle of a URL and roundtrip to their customer...
I'm using Eclipse EPIC IDE to write some Perl CGI scripts which call some Perl modules that I have also written. The EPIC IDE lets me configure a Perl CGI "run configuration" which runs my CGI script. And then I've got Selenium set up and one of my unit test files runs some Selenium commands to run my cgi script through its paces. But...
I have a movie collection catalogue with local links to folders and files for an easy access. Recently I reorganaized my entire hard disk space and I need to update the links and I'm trying to do that automatically with Perl.
I can export the data in a XML file and import it again. I can extract the new filepaths with the use of File::...
I have data that looks like this:
foo 78 xxx
bar yyy
qux 99 zzz
xuq xyz
They are tab delimited.
How can I extract lines where column 2 is empty, yielding
bar yyy
xuq xyz
I tried this but doesn't seem to work:
awk '$2==""' myfile.txt
...
I have a file that looks like this:
ftp://url1/files1.tar.gz dir1
ftp://url2/files2.txt dir2
.... many more...
What I want to do are these steps:
Create directory based on column 2
Unix 'cd' to that directory
Download file with 'wget' based on column1
But how come this approach of mine doesn't work
while(<>) {
chomp;
my ($url...
How do I pass disabled input elements (TT) from page 1 to page 2 in Catalyst framework?
I can do it with hidden input. Is there any other way to handle it?
...
I've got a large XML file, which takes over 40 seconds to parse with XML::Simple.
I'd like to be able to cache the resulting parsed object so that on the next run I can just retrieve the parsed object and not reparse the whole file.
I've looked at using Data::Dumper but the documentation is a bit lacking on how to store and retrieve it...
I have using Perl DBI. In that $dbase->tables() will return all the tables in the corresponding database. Like this I want to know the schema's available in the database. Is there any function available for that?
...
I have a string where different predefined keywords introduce different data. Is there a way to do that using clever use of regexp, or something? Here is an example:
Keywords can be "first name: " and "last name: ". Now I want to parse:
"character first name: Han last name: Solo"
into
{ "first name: " => "Han ", "last name: " => "So...
How to use Operating System Commands in Catalyst Controller?
For example. I want to use Perl system command in Controller .it’s not working ..
Any idea?
In Controller module
my $cmd = "/temp/useradd.sh $username_st1 $_ $log_file &";
system ($cmd );
...
I've seen a few questions/answers here that deal with this, but none really give me an answer/solution.
I've got a Clipper system writing csv files to a Windows directory. I have a perl script running on a Linux server that is reading a mount of that Windows directory and importing the files to a database.
Right now we're using flag f...
If I have a hash in Perl that contains complete and sequential integer mappings (ie, all keys from from 0 to n are mapped to something, no keys outside of this), is there a means of converting this to an Array?
I know I could iterate over the key/value pairs and place them into a new array, but something tells me there should be a built...
Hi!
I need to use NCurses, with Perl. I found some very short bits of text about it but no example at all.
Is there anyone aware of any existing guide online?
Thanks!
...
I have a Perl program which does something like below:
#!perl
use strict;
use warnings;
my $exe = "C:\\project\\set_env_and_run.bat";
my $arg1 = "\\\\Server\\share\\folder1";
my $arg2 = "D:\\output\\folder1";
my $cmd = "$exe \"$arg1\" \"$arg2\"";
my $status = system("$cmd > c:\\tmp\\out.txt 2>&1");
print "$status\n";
I...
I'm looking for an example of redirecting stdout to a file using Perl. I'm doing a fairly straightforward fork/exec tool, and I want to redirect the child's output to a file instead of the parents stdout.
Is there an equivilant of dup2() I should use? I can't seem to find it
...
Trying to get the hang of using OOP in Perl. My problem is that I'm setting a variable in the class, but the value is lost when I try and retrieve it. I'm sure the issue is glaring, but I need some extra eyes.
Constructor:
sub new
{
my ($class, $name) = @_;
my $self = {
_name => $name,
_times => []
};
bl...
My html webpage calls a php script to upload files to the server from a local computer as follows.
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p><b><h3> <font color="#003366"> (1) Upload your reading text file. </font>
</h3> </b> </p>
<INPUT type="file" name="uploaded" size="50" >
<br/>
<input type="submi...