Hi all,
I have a MIME-encoded messages (in Maildir), that are having both base64-encoded headers (solved by lurking for related question ( http://stackoverflow.com/questions/126070/decode-an-utf8-email-header ), decode('MIME-Header', $val), main body in plain text and a text/plain base64 encoded data in the body;
It is said, that base64...
I have a data structure like the following
@colors = qw(red blond green);
@numbers = qw(349 1234.5678 3.14159265);
@hats = qw(fedora porkpie bowler);
my %hash = (colors => \@colors, numbers => \@numbers, hats => \@hats);
I want to sort this according to the values of one of the arrays, maintaining the association of parallel array ele...
I am trying to generate an xls file with Spreadsheet::SimpleExcel that calls a function that is defined in a third party add in (Bloomberg, if it matters). The underlying WriteExcel package does not let me write this out because it does not know about this add-in function. I see the giant hash table of built-in functions that the modul...
try.pl is a script that is trying to generate sample.xml which should validate against sample.xsd. I am getting some errors. Guide me if possible.
portion of sample.xsd
<xs:element name="element1" maxOccurs="unbounded">
<xs:complexType>
<xs:SimpleContent> <---- line number of error
<xs:extension base="xs:token">
...
I developed a script (mainly by visiting multiple solutions and mashing together my favorite) to find and replace words in files. The files are all contained in a directory. For some reason, my script goes into an infinite loop, however it appears that it works.
I would appreciate any explanation as to why it won't exit the loop.
#!/us...
I'm trying to make a basic multiprocessing task and this is what I have. First of all, I don't know the right way to make this program as a non-blocking process, because when I am waiting for the response of a child (with waitpid) the other processes also have to wait in the queue, but, what will happen if some child processes die before...
I'm trying to split a string using the split function but there isn't always a value between tokens.
Ex: ABC,123,,,,,,XYZ
I don't want to skip the multiple tokens though. These values are in specific positions in the string. However, when I do a split, and then try to step through my resulting array, I get "Use of uninitialized value"...
Hi All,
I am trying to open a external command from Perl using system call. How can I pass arguments to it one after another? ( forgot to add this i am running perl on windows machine )
ex:- system("ex1.exe","arg1",arg2",....);
here ex1.exe is external command and i would like it to process arg1 first and then arg2 and so on...
I...
I have an array like this
my @stopWords = ("and","this",....)
My Text is in this variable
my $wholeText = "....and so this is...."
I want to match every occurrance of every element of my stopWords array in the scalar wholeText and replace it by spaces.
One way of doing this is as follows :
foreach my $stopW (@stopWords)
{
$wh...
I have a few Moose objects and some other simple hash objects (hashes, arrays) I'd like to serialize.
At first, I used a simple
my $obj_store_file = nstore($obj);
and
my $obj = retrieve($obj_store_file);
This worked well.
Later, I found about MooseX::Storage and KiokuDB. I tried using them to enjoy some benefits they have, but:
...
I have a code that try to find the Eulerian path like this. But somehow it doesn't work.
What's wrong with the code?
use strict;
use warnings;
use Data::Dumper;
use Carp;
my %graphs = ( 1 => [2,3], 2 => [1,3,4,5], 3 =>[1,2,4,5], 4 => [2,3,5], 5 => [2,3,4]);
my @path = eulerPath(%graphs);
sub eulerPath {
my %graph = @_;
# ...
perl script.pl --f1="t1" --f2="t2" --f3="t4" --f4 < /home/joe/a.txt
script.pl
use Getopt::Long;
my ($f1, $f2, $f3, $f4) ;
GetOptions (
'f1=s' => \$f1,
'f2=s' => \$f2,
'f3=s' => \$f3,
'f4' => \$f4, );
if ( $f1) {
system('stty -echo');
print "Password:";
$pwd = <STDIN>;
syst...
I was trying to serialize some (Moose) objects with YAML -- simply by using YAML's Dump() and Load(). After loading a serialized object, it didn't 'work' until I added a use statement with the original module name. If I don't use use I won't get any error until I try to invoke some object method, then it will croak saying it can't find ...
There is something like status changes check logic in our app.
Currently checking is being handled by ugly if statement
I want to replace it by transition matrix:
my %allowed_status_changes = (
1 => (2,5),
2 => (1,2,3,4,5),
3 => (4,2),
4 => (3,2),
5 => (),
);
my $is_allowed_transition =
...
I have been thrust into taking over some code but I may be out of my element in figuring this one out. If someone could give me a hint I'd appreciate it. I'm enjoying learning this code but every now and then I need a push.
When looking through this code I came across this line:
my @files = My::Module::DB::raw_info->search_like(custom...
use strict;
my @array=('f1','f2','f3');
my $dir ='\tmp';
foreach (@array) {
my $FH = $_;
open ("$FH", ">$dir/${FH}.txt") or die $!;
}
foreach (@array) {
my $FH = $_;
close($FH);
}
i got "Can't use string ("f1") as a symbol ref while "strict refs" in use at bbb.pl line 6." error . What is the isuse ?
...
Hello and good evening dear Stackoverflow-friends,
First of all.-This is a true place for learning. I am new to programming - and i am sure that this is a superb place for all novices!
I am a beginner - and i learn the most in practical situations - real live situations...So here is one!
I like Web::Scraper because it is a web scrape...
I'm using the GD::bars module in Perl v 5.8, but I can't seem to get the font size on my graphs x and y labels and values to change. Here's the relevant code I am using:
use GD::Graph::bars3d;
use GD::Text;
$my_graph->set_title_font(gdMediumBoldFont, 15);
$my_graph->set_x_label_font(gdMediumBoldFont, 15);
$my_graph->set_y_label_font(...
I'm coding a web crawler and I've been using WWW::Mechanize::Firefox to navigate some pages (for the others I use WWW::Mechanize) which keep loading content after the page loaded and I've never had an issue with that.
Yesterday I added DBI and DBD::mysql to the script, adding queries to export data to a database (this works perfectly), ...
Hi, Im writing a program that manage muti-processes. This is what I have done and its working great! but now, I want to send messages from the child processes to the parent process and viceversa (from the parent to the childs), do you know the best way? Do you know if what I have done is the proper way for what I want (send messages, or ...