This seems redundant, running perl from a Perl script itself.
my $Pref = "&*())(*&^%$#@!";
system("perl -pi -e 's|^SERVERNAME.*\$|SERVERNAME \"\Q$Pref\E\"|g' pserver.prefs");
What is the actual Perl code that will mimic -pi? I just want something that would work like sed on Perl, just as simple as can be.
Based on Todd Gardner's s...
I have a file that contain huge number of net names. I would like to compress the bus nets as below:
abc/def/gh[0]
abc/def/gh[1]
abc/def/gh[2]
ab/ef/xx
abc/def/gh[3]
to
abc/def/gh[3:0]
ab/ef/xx
...
Greetings,
I'm learning Moose and I'm trying to write a CGI::Application subclass with Moose, which is made difficult by the fact that CGI-App is not based on Moose.
In my other CGI-App subclasses, I like to have a parent class with a setup method that looks at the child class's symbol table and automatically sets up the runmodes. I f...
I tried removing all newlines (\n) from the values of a hash:
my %var_h = ( "ID" => " This is Test
This is new line TEST
newline Test end ");
How can I remove all the new lines from the values of %var_h?
I tried s/\\n//g but I could not get it to work.
...
The following is the data I am working on:
__DATA__
Node 1:
98 debug : fill 100
102 debug : fill 104
Node 2:
88 debug : fill 120
152 debug : fill 164
I want to write a regex/(or whatever is appropriate) to capture information from data below Node 1, say '98 : 100', but only after identification of N...
Greetings,
As a followup to my previous question about Moose, I've now run into a new problem. I've got a Moose class which uses Recipe 12 in order to extend a non-Moose parent class. Here it is:
package MyApp::CGI;
### TODO: make this work with MooseX::Declare?
use Moose;
extends 'CGI::Application';
sub new {
my $class = shif...
I'm new with this Perl Win32::OLE automation. I have been reading and trying out some examples. I have a few questions (excuse me if i'm using incorrect terminologies - do correct me):
Can OLE be used to automate Visual
Studio 2005? I only found examples
with Word, Excel and IE. How do
you know which app can be used?
How do I get the n...
How can I find and display the word $iperf in a file
The file will look like this
$iperf -c 172.29.38.67 -m -M 64 -i 5 -t 20 -P 10
WARNING: attempt to set TCP maximum segment size to 64, but got 536
WARNING: attempt to set TCP maximum segment size to 64, but got 536
WARNING: attempt to set TCP maximum segment size to 64, but got 536
...
In my new job more people are using Python than Perl, and I have a very useful API that I wrote myself and I'd like to make available to my co-workers in Python.
I thought that a compiler that compiled Perl code into Python code would be really useful for such a task. Before trying to write something that parsed Perl (or at least, the ...
Can anyone tell me where can I find a Perl program which decrypts a password
and then encrypts it using the blowfish algorithm? I found one but it is in Java, but I don't know much about that language. =(
anyway.. thanks for those who answered, esp to Konstantinos? hmm.
...
I've got a Windows XP batch script which cleans some directories, but I would like to move the deleted files to trash instead of using plain del. How is this done?
It looks like the only languages I can use for this is plain batch or Perl.
...
I am creating a file-oriented database of some test results performed by various users. For this I need to generate unique id for every entry in the database. The ids must satisfy following requirements:
Ids should be fairly small (6 characters at most)
For every test case and user combination each time same id should be generated
Wh...
How can I write a web application in Perl so that it can work as plain CGI script, as FastCGI / FCGI script, and from mod_perl / mod_perl2 (preferably using only core Perl modules and those from libwww-Perl, and minimizing number of Perl CPAN modules one has to install)? I'd like to minimize changes one has to do to change script from u...
Following is the script for matching regex and storing value in array:
sub b1 {
# print $_;
my @file = @_;
my @value;
my $find = qr/(\s+)([0-9]+)\s([A-Z])\s[0-1].[0-9]+\s->\s([A-Z])\s/;
foreach my $file(@file){
push (@value, $file=~ /$find/) ;
print "\n";
}
...
Can anyone explain how variable scoping works within a POE session? What is the proper way to pass state within the session, without impacting other sessions?
Thanks
Josh
...
I'm trying to use Apache::Session::Memcached in an HTML::Mason project where I'm using MasonX::Request::WithApacheSession to handle my sessions. Unfortunately Apache will not launch when I plug in the Memcached module instead of the MySQL one. My custom handler looks something like this (a few snips here and there):
my $ah = HTML::Mas...
I am new to this field. So kindly go easy on me. I have two arrays:
@array1 = ("ABC321", "CDB672", "PLE89",....);
@array2 = ("PLE89", "ABC678", "LMD789",...);
I want to compare elements of these two different arrays. But, I want to only match letters with letters. So for instance, if arrays are compared, $array[2] element (PLE) shoul...
I found this Perl script while migrating my SQLite database to mysql
I was wondering (since I don't know Perl) how could one rewrite this in Python?
Bonus points for the shortest (code) answer :)
edit: sorry I meant shortest code, not strictly shortest answer
#! /usr/bin/perl
while ($line = <>){
if (($line !~ /BEGIN TRANSACTION...
Is there anyway easier than this to strip HTML from a string using Perl?
$Error_Msg =~ s|<b>||ig;
$Error_Msg =~ s|</b>||ig;
$Error_Msg =~ s|<h1>||ig;
$Error_Msg =~ s|</h1>||ig;
$Error_Msg =~ s|<br>||ig;
I would appreicate both a slimmed down regular expression, e.g. something like this:
$Error_Msg =~ s|</?[b|h1|br]>||ig;
Is there a...
I am trying to setup a basic error checking system where it will catch shell errors run by a system call. execute_command is a webmin function that runs a system call and then sets an error message to its 4th parameter. I basically call execute_command_error("adduser test"), knowing that I already have a user called test created and base...