Hello,
Please kindly help me in the following,
I have $sub = C:\views\sght\gzad\text\hksdk\akldls\hool.java
= C:\views\sght\bdsk\text\hksdfg\sdjks\same.java
= C:\views\jdjk\jhah\fjd\afhlad\sitklds\hgls.jsp
I need to replace every "\" with a "."
I need to split the $sub such a way that
if $sub contains the "text" then…
Hi everyone,
I can't get why this code work:
$seq = 'GAGAGAGA';
my $regexp = '(?=((G[UCGA][GA]A)|(U[GA]CG)|(CUUG)))'; # zero width match
while ($seq =~ /$regexp/g){ # globally
my $pos = pos($seq) + 1; # position of a zero width matching
print "$1 position $pos\n";
}
I know this is a zero width match and it dosn't put the matched…
I have two arrays A & B. I want to do a compare among the elements of the two arrays.
my @a = qw"abc def efg ghy klm ghn";
my @b = qw"def ghy jgk lom com klm";
If any element matches then set a flag. Is there any simple way to do this? Please advise.
Hi,
I use this codition to check if the value is alphanumeric values:
$value =~ /^[a-zA-Z0-9]+$/
How can I modify this regex to account for a possible dot "." in the value without accepting any other special characters?
I have been trying several regular expressions
$str =~ s/^0+(.)/$1/;
converts 0000 to 0 and 0001 to 1
$str =~ s/^0+./$1/;
converts 0000 to empty string, 000100 to 00, 0001100 to 100.
what difference is the parentheses making?
opendir MYDIR, "$dir";
my @FILES = readdir MYDIR;
closedir MYDIR;
It appears that 99.9 % of the time the first two entries in the array are always “.” and “..”. Later logic in the script has issues if it is not true. I ran into a case where the directory entries appeared later. Is this indicative of the file system being corrupt or…
I use use lib "./DIR" to grab a library from a folder elsewhere. However, it doesn't seem to work on my server, but it works fine on my local desktop.
Any particular reasons?
And one more question, does use lib get propagated within several modules?
Two situations:
Say I make a base class that requires a few libraries, but I know…
I need to write a daemon that supposed to have one TCP socket and one named pipe. Usually if I need to implement a multi IO server with "pure" sockets, the select based multi-IO model is always the one I will choose. so does anyone of you have ever used named pipe in select or you
can just tell me it is impossible. thanks in…
How can I tar multiple directories and also append files with some pattern like '.txt' and exclude some directories and exclude some patterns like '.exe' all into a single tar file. The main point is the number of directories are unknown(dynamic), so I need to loop through..I guess?
I have an Apache2/mod_perl2 system up and running.
I'm using GD to create an image on the fly, and I'm then printing it like this:
$r->content_type('image/png');
binmode STDOUT;
print $im->png;
But is this the correct way to do things in mod_perl2?
(Ignore the fact that I'm generating an image on the fly and not…
I want to pull in data using a XML::XPath parser from a XML DB file from the Worldbank site. The problem is that I'm not seeing any results in the output. I must be missing something in the code. Ideally, I would like to extract just the death rate statistics from each country XML DB (year and value). I'm using this as…
I have 3 Columns of data:
Item | CreateDate | Version |
ABC | 1/1/2010 | X |
ABC | 3/15/2010 | XB |
BBB | 2/15/2010 | X |
BBB | 6/15/2010 | X |
How might I populate two additional columns of data named Version Start & Version End that would calculate the start…
I'm running an experiment on Berkeley DBs. I'm simply removing the contents from DB a and reinserting the key-value pairs into DB b. However, I am getting Wide character errors when inserting key-value pairs into this DB b. Help?
Hello,
Suppose I have a path in a string called '/home/user/directory/HelloWorld.txt'. I would like to remove the HelloWorld.txt, and end up with '/home/user/directory'. What regex would I need.
I had to make a really small and simple script that would fill a table with string values according to these criteria:
2 characters long
1st character is always numeric (0-9)
2nd character is (0-9) but also includes "X"
Values need to be inserted into a table on a database
The program would execute:
insert into…
I have this line ( it's a single line, SO makes it seem like 2 ):
/Od /D "WIN32" /D "_DEBUG" /FD /EHa /MDd /Fo"Debug" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr /TP .\main.cpp"
And I want to extract the .\main.cpp. I thought the following would do the trick:
if($string =~ /.*\s+(.*)$/i) {
print "matched ",$1,"\n";
}…
Hi,
I need to come up with a regular expression to validate hostname against
RFC-1123 and RFC-952.
Right now I'm using this:
^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?)*\.?$/
but this does not do the trick since it does not catch…
I use the following code for printing the line number in Text widget.
my $c=0; my $r=0;
$txt = $mw-Text( -background
='white',
-width=>400,
-height=>300,
-selectbackground => 'skyblue',
-insertwidth => 5,
…
Hi all,
I have used the module Mail::Webmail::Gmail to read the new messages in my gmail account.
I have written the following code for this purpose.
use strict;
use warnings;
use Data::Dumper;
use Mail::Webmail::Gmail;
my $gmail = Mail::Webmail::Gmail->new(
username => 'username', password =>…
I'm setting something up to SSH out to several servers in 'batches'. I basically want to maintain 5 connections at a time, and when one finishes open up another (following an array of server IPs).
I'm wondering for something like this should I be using fork()? If so, what logic can I use to ensure that the I…