I am considering this random string generator in perl:
sub generate_random_string {
my $length = 12;
my @chars = qw/2 3 4 5 6 7 8 9 A B C D E F G H J K M N P Q R S T U V W X Y Z/;
my $str = '';
$str .= $chars[int rand @chars] for 1..$length;
return $str;
}
How many unique strings will this generate? If I extend th...
I tried running:
perl -e "use Error;"
from cmd in windows 7. (active perl 5.12 installed on system) and I am getting the error
Can't locate Error.pm in @INC (@INC
contains: C:/Perl64/site/lib
C:/Perl64/lib )
I manually searched and found Error.pm in C:/Perl64/lib/CPANPLUS.
Does anyone have an idea what could be going o...
I've searched around but haven't quite found what I'm looking for. In a nutshell I have created a bash script to run in a infinite while loop, sleeping and checking if a process is running. The only problem is even if the process is running, it says it is not and opens another instance.
I know I should check by process name and not pr...
I have some text files which I am trying to transform with a Perl script on Windows. The text files look normal in Notepad+, but all the regexes in my script were failing to match. Then I noticed that when I open the text files in NotePad+, the status bar says "UCS-2 Little Endia" (sic). I am assuming this corresponds to the encoding U...
Hi All,
I'm attempting to import code written in linux into eclipse's perl plugin 'epic', and have installed activestate perl in windows. Most of the modules have an activestate equivalent, but some of them I can't find in ppm. Does anyone know how I can get the following modules so that the code can compile?
File::Finder
Spread...
I have the following Perl code:
push(@myArray, $myValue);
Is the operation atomic, or will I need to use locks, if multiple threads will be performing this same operation on many threads?
...
I have a Perl program that is reading html tags from a text file. (im pretty sure this is working because when i run the perl program on the command line it prints out the HTML like it should be.)
I then pass that "html" to the web page as the return to an ajax request. I then use innerHTML to stick that string into a div.
Heres the pr...
HI,
Actually i am trying to reduce the time taken to transfer N-number of files from remote machine local machine using secure file transfer, previously i used scp system command it establishes a connection for each file transfer.
Thanks in advance.
...
I have module called Mobile::Auth to authorize and redirect to the login page. I wanted to access all methods from Site::Auth in my Mobile::Auth except a method '*redirect_to_login_page*', which I have specific one for my Mobile::Auth. I did something like this..
package Mobile:Auth;
use base Site::Auth;
sub redirect_to_login_page{
#g...
Could someone provide snippet/links for perl code for identification usb events (plug and unplug) on windows.
...
I have a text file, and a function to retrieve from that text file:
@thefile = read_file( 'somepathfile' );
I would like to have a different implementation of the read_file function depending on which type is receiving the information.
So if I write:
%thefile = read_file( 'somepathfile' );
then a different function will be execute...
Is it possible to have Vim autocomplete show which functions are available to a given module?
So if I include a module called math and then go:
math::
and at that i could get a list of the functions available through that module.
...
I want to merge several xml files in perl. Each file is composed of a lot of elements; I need to merge data with the same element from these files. e.g.
file1 has elements {e1, e2, e4}
file2 has elements {e1, e3, e4}
file3 has elements {e2, e4, e5}
so I need to merge e1 of file1 with e1 of file2, merge e2 of file1 and e2 of file3, e...
Hi I have two images of yeast plates:
Permissive:
Xgal:
The to images should be in the same spot and roughly the same size. I am trying to use one of the images to generate a grid and then apply that grid to the other image. The grid is made by looking at the colonies on permissive plate, the plate should have 1536 colonies on it....
At $work, we maintain a set of Perl modules at a central location for easy inclusion via PERL5LIB. As there is a re-installation ahead and we need to provide the modules for both 32 and 64 bit architecture, we are wondering if it's better to install them into the same directory tree, relying on the $archname subdirectories, or keep the t...
use Crypt::CBC;
my $crypt = Crypt::CBC->new(-key => "password", -cipher => "Crypt::Blowfish");
print $crypt->encrypt_hex('s');
How do I get the same result using java?
Thanks in Advance.
...
I'm trying to add a feature to a legacy script. The script is suid, and uses perl -T (taint mode: man perlsec), for extra security. The feature I need to add is implemented in Python.
My problem is that I can't convince perlsec to preserve the suid permissions, no matter how much I launder the environment and my command lines.
This is...
#!/usr/bin/perl
use strict;
use warnings;
open(my $vmstat, "/usr/bin/vmstat 1 2>&1 |");
open(my $foo, ">", "foo.txt") or die "can't open it for write";
while(<$vmstat>) {
print "get ouput from vmstat and print it to foo.txt ...\n";
print $foo $_;
}
when I run the above code, nothing wrong happend.but after I press ctr-c to qui...
The following code is a shortened version of an example from HTML::Parser
#!/usr/bin/perl -w
use strict;
my $code = shift || usage();
sub edit_print { local $_ = shift; tr/a-z/n-za-m/; print }
use HTML::Parser 3.05;
my $p = HTML::Parser->new(unbroken_text => 1,
default_h => [ sub { print @_; }, "text" ],
text_h => [ \&edit...
I am just trying to learn some Perl, so I am going through one function just to get grip on the language. Could somebody explain to me what this function is doing exactly?
#! /usr/bin/perl
use strict;
my %hash;
&Parse('first.txt');
&Parse('second.txt');
my $outputpath = 'output.txt';
unlink ($outputpath);
open (OUTPUT, ">>$out...