I have two arrays of strings that I would like to compare for equality:
my @array1 = ("part1", "part2", "part3", "part4");
my @array2 = ("part1", "PART2", "part3", "part4");
Is there a built-in way to compare arrays like there is for scalars?
I tried:
if (@array1 == @array2) {...}
but it just evaluated each array in scalar context,...
Hello,
I'm already developing that project to my family, but now i'm needing to link a Name to another aleatory(remember that the first name i have it) and store only the second name in a variable, remember that this list is a file(*.txt) with some names, but how i can do this? Thanks.
...
Using the Catalyst::Controller::FormBuilder module to handle forms in a Catalyst application.
The documentation says you can set the form_path like this:
form_path => File::Spec->catfile( $c->config->{home}, 'root', 'forms' ),
But the call to config() in my application is at the top level of the base module. Therefore, $c is undefined...
I have some data on a single line like below
abc edf xyz rfg yeg udh
I want to present the data as below
abc
xyz
yeg
edf
rfg
udh
so that alternate fields are printed with newline separated.
Are there any one liners for this?
...
Suppose File 1 has two columns and looks something like:
fuzz n. flowering shrub of the rhododendron family
dyspeptic adj. bright blue, as of the sky
dysplexi adj. of Byzantium or the E Roman Empire
eyrie adj. of the Czech Republic or Bohemia
azalea adj. suffering from dyslexia
Czech adj. suff...
Hello all,
I have multiple email id's in some config files in a directory; I'm running my scripts on a Solaris machine. I want to perform the following:
Find all the email_id's in the config files in a directory:
eg: [email protected] ; [email protected] ; [email protected] ; [email protected]
Replace all existing id's with:
wxyz@hotmail....
I already know how to convert the non-utf8-encoded content of a file line by line to UTF-8 encode, using something like the following code:
# outfile.txt is in GB-2312 encode
open my $filter,"<",'c:/outfile.txt';
while(<$filter>){
#convert each line of outfile.txt to UTF-8 encoding
$_ = Encode::decode("gb2312", $_);
...}
...
I know that any language is capable of parsing XML; I'm really just looking for advantages or drawbacks that you may have come across in your own experiences. Perl would be my standard go to here, but I'm open to suggestions.
Thanks!
UPDATE: I ended up going with XML::Simple which did a nice job, but I have one piece of advice if you ...
I have an XML file, with some format. I want the data to be modified in some way I want. I feel XML::Twig is the way to do it.
I want to know if there is any other better alternative?
...
How can I extract the first paragraph of a PDF document using Perl's CAM::PDF?
...
We deal with alot of UGC (1m+/mo) and sometimes our users will input large strings with no spaces which causes web browsers to display content in a strange manner, breaking UI here and there.
I am trying to find a way to intelligently and quickly process text up to 50k and insert tags where appropriate.
I have already built this, but ...
I am beginning to delve deeper into Perl, but am having trouble writing "Perl-ly" code instead of writing C in Perl. How can I change the following code to use more Perl idioms, and how should I go about learning the idioms?
Just an explanation of what it is doing: This routine is part of a module that aligns DNA or amino acid sequences...
I would like to try and use Perl, but need to communicate with another application I wrote. I have an interface library that I wrote in C++, and it contains the socket communications and interface protocol to set/get parameters in my application.
I would like to use Perl with Apache to serve up web pages for configuring my application....
I have a file which has
<Doc>
<Text>
....
</Text>
</Doc>
<Doc>
<Text>
</Text>
</Doc>
How do I extract only the <text> elements, process them and then extract the next text element efficiently?
I do not know how many I have in a file?
...
Hello,
I'm learning Perl and at the same time I'm creating a program to my family events, but when I'm trying to use a array with a randomization process I'm getting some errors, as you could see:
[ubuntu@eeepc:~/Desktop/mail] ./get.pl -h pop.vix.terra.com.br -u nathanpc -p (:D)
Global symbol "$random_name" requires explicit package n...
I've already learnt how to remove duplicates in Perl using the following code:
my %seen = ();
my @unique = grep { ! $seen{ $_}++ } @array;
But what about if I want to merge the overlapping parts? Is there a simple way like the above code to directly do the job?
For example a bit of the input file looks something like this:
Anais Ni...
How do I print a hash from within a string, as in
print "\n[*] Query : $select { query }";
versus
print "\n[*] Query : " . $select { query };
...
I would like to read a little more about the + that is usually put in front of a hashref that helps to disambiguate from a code block.
When was it first introduced?
Who first introduced it (recommended it)?
How did people go around the issue before this was introduced?
Any trivia or notes that comes to mind while using this syntax?
...
Hi!
I've started a little pet project to parse log files for Team Fortress 2. The log files have an event on each line, such as the following:
L 10/23/2009 - 21:03:43: "Mmm... Cycles!<67><STEAM_0:1:4779289><Red>" killed "monkey<77><STEAM_0:0:20001959><Blue>" with "sniperrifle" (customkill "headshot") (attacker_position "1848 813 94") (...
Hi,
perl -MO=Concise,-exec myprog.pl
should do it but it only prints the syntax of the lines that are outside any procedures, and the main package itself. It does not print the syntax tree of packages and functions used in myprog and imported.
Could someone tell me how to tell "B::Concise" to print all functions in myprog.pl.
...