I started to really like C#'s ?? operator. And I am quite used to the fact, that where there is something handy in some language, it's most probably in Perl too.
However, I cannot find ?? equivalent in Perl. Is there any?
...
I am using a hash table similar to the following to store the letters that can be entered at a prompt along with that option's description and the function that will be called.
my %main_menu = (
"l" => ["list locks", \
menu_prompt(\%main_menu) produces the following menu:
________________________
| l - list locks |
| n ...
I use Eclipse on Windows to edit files on a remotely mounted Linux SMB share.
Coupled with Samba's stubborn opposition to on-the-fly mapping, Eclipse's insistence on CR/LF creates a real headache with Perl scripts.
Any workarounds?
...
Hello all.
$stuff = "d:/learning/perl/tmp.txt";
open STUFF, $stuff or die "Cannot open $stuff for read :$!";
while (<STUFF>) {
my($line) = $_; # Good practice to always strip the trailing
chomp($line);
my @values = split(' ', $line);
foreach my $val (@values) {
if ($val == 1){
print "1 found";
...
Is it possible to do part of a web flow in Perl and then transfer the rest of the session to Firefox?
I need to retry(with Perl) logging in to a website which returns 500 every now and then on a successful login, transfer the authenticated session to Firefox, from where I can continue my normal browsing. Is this possible?
If this is poss...
Programming is so new to me that I apologize for not knowing how to phrase the question.
I have a Perl script that gets a variable from an internal tool. This isn't always what it looks like, but it will always follow this pattern:
darren.local 1987 A Sentence1
darren.local 1996 C Sentence2
darren.lo...
I am looking for a Windows Perl IDE with debugger like Komodo but free.
I have seen Eclipse+EPIC but I don't want to install Eclipse here .
Padre doesn't have debugger built in.
...
I'm trying to test whether a user is registered on FreeNode. nick_info() doesn't seem to return information about this, so I want to use $irc->yield(whois => $nick); and then grab the irc_whois event's reply. The problem is that I want to wait until this event is fired, so I created a global variable $whois_result and wrote a sub like th...
I want to generate random hex values and those values should not be repetitive
and it should be of 4 bytes (ie: 0x00000000 to 0xffffffff) and the display output
should contain leading zeros.
For example: if I get the value 1 it should not represented as 0x1 but 0x00000001.
I want a minimum of 100 random values. Please tell me: how ...
I have a string like this:
a b c d
I process my string like this:
chomp $line;
my @tokens = split /\s+/, $line;
my @new_tokens;
foreach my $token (@tokens) {
push @new_tokens, some_complex_function( $token );
}
my $new_str = join ' ', @tokens;
I'd like to re-join the string with the origi...
Could someone provide a link of material where to start with Perl 6?
Also could someone point to real application already developed with Perl 6?
...
I had enabled telnet client feature on Windows 2008, and tried to launch it from a Perl script:
perl -e "system('c:\windows\system32\telnet localhost')"
Then I got an error like this:
'c:\windows\system32\telnet' is not recognized as an internal or external command,
operable program or batch file.
I could run it from 'cmd' terminal...
Is it possible to uninstall an application in windows using a Perl script?
...
I have a cross-platform Perl program that starts a win32 windows program on win, and a macosx appliaction on the mac.
I use system(), which on the mac makes the stdout of the invoked program, be written in the stdout of the Perl program, which is what i want.
On Windows, it seems like there is no way to get the stdout a Windows program...
I'm trying to read out the POST-Data that was sent from a form in a page to my Perl Script. I googled and found out that:
read(STDIN, $param_string, $ENV{'CONTENT_LENGTH'})
reads out the whole Data-String with and writes the whole string to $param_string in the form of
Param1=Value1&Param2=Value2&Param3=Value3
by spliting it at the...
I'm using ack (the grep replacement) on Windows XP under Strawberry Perl. Where should the .ackrc config file be placed, since ~/.ackrc is not reasonable on Windows?
...
I'd like a simple perl script / sub to read a sql server table into a hash, does anyone have a good script or snippet (with 'use's) that can do this given a connection string and table name?
Here's a template:
sub sqltable {
my ($connStr,$table) = @_;
my ($user, $password, $host) = ($connectstr =~ m|^(.*)/(.*)@(.*)$|); ...
Is there a webserver or HTTP server module in the Perl standard library or in CPAN or elsewhere? I guess I'm looking for the equivalent of Python 3's http.server module. Thanks!
...
As per subject: what are the characters that can be used in hash keys or, if it's shorter, which ones can't be used?
Also, are there any problems in using long hash keys (like full path names)?
...
How can I fetch the last row that was inserted using DBI (DBD::mysql)?
Code sample:
my $sth = $dbh->prepare('INSERT INTO a ( x, y, z ) VALUES ( ?, ?, ? )');
$sth->execute( $x, $y, $z );
How can I get access to the data that was inserted by the above prepare statement? I need to get the primary ID (AUTOINCREMENT) value.
UPDATE:
From...