perl

Why a full stop, "." and not a plus symbol, "+", for string concatenation in PHP?

Why did the designers of PHP decide to use a full stop / period / "." as the string concatenation operator rather than the more usual plus symbol "+" ? Is there any advantage to it, or any reason at all? Or did they just like to? :o) ...

How can I show Perl console output in a GUI?

I have several simple Perl programs writing to the standard output, but this has some problems : some of my users are scared by a console my users works on Windows, so my program output is displayed on a cmd console, so I cannot control the way it is displayed (colors and terminal size), and worse, the console is not resizeable (at lea...

How to parse time stamps with Unicode characters in Java or Perl?

I'm trying to make my code as generic as possible. I'm trying to parse install time of a product installation. I will have two files in the product, one that has time stamp I need to parse and other file tells the language of the installation. This is how I'm parsing the timestamp public class ts { public static void main (String[]...

How can I find strings that have mixed cased with Perl?

I'm trying to filter thousands of files, looking for those which contain string constants with mixed case. Such strings can be embedded in whitespace, but may not contain whitespace themselves. So the following (containing UC chars) are matches: " AString " // leading and trailing spaces together allowed "AString " // trailing sp...

Perl DBD::ODBC Issues with Oracle Date Formats

I am using Perl's DBD::ODBC to connect to an Oracle database. However, an issue arises when I try to execute a select query using a date in the where clause. It seems this issue occurs because of the database's date format being DD-MON-RR (see DBD::ODBC::FAQ). Since I cannot change the database's settings, can anyone suggest a workaro...

How can I get one Perl script to see variables in another Perl script?

I have a Perl script that is getting big, so I want to break it out into multiple scripts. namely, I want to take out some large hash declarations and put them into another file. How do I get the original script to be able to see and use the variables that are now being declared in the other script? This is driving me nuts because I hav...

How do I configure Strawberry Perl to run from something other than c:\strawberry?

I know that Strawberry Perl portable is out there for Perl 5.10.0, but so far, there is not one for Perl 5.10.1. As a result, I'm currently doing some experimental work in getting Strawberry Perl to run from a networked location, just to see what I can get working. I've been able to fake some of it, enough to get some Perl and some too...

How do I schedule a task in Perl?

Does anyone knows if perl supports a task scheduler? I am working on a c# program that controls a bunch of perl scripts. The perl script talked to some device over the socket interface. The device, "target" , is a embedded system device that require real time interaction. One of the requirements I need to fulfill is that when I recei...

Masking a string in perl using a mask string

I have a string such as 'xxox-x' that I want to mask each line in a file against as such: x's are ignored (or just set to a known value) o's remain unchanged the - is a variable length field that will keep everything else unchanged therefore mask 'xxox-x' against 'deadbeef' would yield 'xxaxbeex' the same mask 'xxox-x' against 'dea...

How do I present an open folder selection dialog in Perl?

How do I open folder selection dialog in Perl? ...

How can I listen on multiple sockets in Perl?

I want to listen on different sockets on a TCP/IP client written in Perl. I know I have to use select() but I don't know exactly how to implement it. Can someone show me examples? ...

How do I install Perl modules on machines without an Internet connection?

I need to install my Perl-based software on networked machines which aren't connected to the internet. Therefore, I would like to download specific versions and/or latest versions of the Perl modules and I would also like to know if there is an install procedure required for these modules. Background: The machines aren't connected to th...

How can I add an image to a table in Perl?

I have developed a database using Perl DBI and display using Perl CGI. Can you please suggest syntax for adding an image to the table and its background in the database. ...

What is /^ and /i in Perl?

Recently I downloaded a source (LevBot) and then I see this line: } elsif($text =~ /^slaps $levbot_nick/i) { But what /^ and /i do? Why to use they? I think this is regular expression, I'm right? ...

Encapsulating Content In a Variable

Hello, I want to know how can I encapsulate the result(substr($text, 12)) of the variable $opt into itself(put the result replacing the expression substr($text, 12)), but how I can do this? If needed. Here is my code: my $text; my $opt = substr($text, 12); if ($command =~ /^Hello World Application/i) { print "$opt\n"; } # More code...

Why doesn't Perl allow one liners to be 'unblocked'?

for example: if (something) function(); else nope(); ...

Perl socket programming problems after continuous write to socket

I am using IO::Socket::INET to create socket like this: $lsn1 = IO::Socket::INET->new( PeerAddr => '192.168.0.2', PeerPort => 1850, Proto => 'tcp', Type => SOCK_STREAM ) || die "Can't connect to 192.168.0.2:1850 :...

Should I use YAML or JSON to store my Perl data?

I've been using the YAML format with reasonable success in the last 6 months or so. However, the pure Perl implementation of the YAML parser is fairly fidgety to hand-write a readable file for and has (in my opinion) annoying quirks such as requiring a newline at end of the file. It's also gigantically slow compared to the rest of my pr...

Why do Perl control statements require braces?

This may look like the recent question that asked why Perl doesn't allow one-liners to be "unblocked," but I found the answers to that question unsatisfactory because they either referred to the syntax documentation that says that braces are required, which I think is just begging the question, or ignored the question and simply gave bra...

Select value with Linux command xpath (from Perl)

I want to get an attribute out of a XML-Tree. Therefor I use the command xpath from package libxml-xpath-perl. I figured out this command: virsh dumpxml save | xpath -e "/domain/devices/disk[@type='file']/source/@file[1]" This gives me file="/var/lib/libvirt/images/save.raw" How can I select the value only? (/var/lib/libvirt/image...