perl

Perl: calling another_script.pl with parameters from script.pl and w/o system,backticks and modules

I have two scripts and two conf file (actually perl scripts too): conf1.pl @some_array = ({name =>"orange", deny = > "yes"}, {name =>"apple", deny = > "no"}); conf2.pl @some_array = ({name =>"male", deny = > "yes"}, {name =>"female", deny = > "no"}); script.pl #!/usr/bin/perl -w use strict; our %deny...

Why am I getting an "Out of memory" error with Perl's XML::Simple?

Edited:: Hi All, I have a XML file like this, <message> <c1> <rrcConnectionSetupComplete> <rrc-TransactionIdentifier>2</rrc-TransactionIdentifier> <criticalExtensions> <c1> <rrcConnectionSetupComplete-r8> ...

How do I use `lock_hash_recurse` in Perl?

In continue to the discussion here, I'm havind some trouble with lock_hash_recurse as illustrated below: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Hash::Util qw (lock_keys); my $hashref = {A=>1, B=>{CC=>22, DD=>33}}; lock_keys(%{$hashref}); # this is OK Hash::Util::lock_hash_recurse(%{$hashref}); # this fails: "...

How do I update all my CPAN module to their latest versions?

I know this is really simple... sorry :) ...

How do I get the first item from a function that returns an array in Perl?

Hi, I have a function that returns an array, and I'd like to get just the first item from that array without ever declaring a variable for the array. Basically, it should be something like: functionReturningArray()[1] Except that doesn't work. I really don't want to waste space declaring the whole array since I don't need it, and I'...

How can I print the name of a given Perl variable (not its value)?

Possible Duplicates: Perl sub to print out a variable and its value How to get name of object in perl I'm trying to create a sub called "debug" in an existing Perl script (which runs as a CGI under Apache2) and I want to call it from any other sub in the script and pass it the name of a local variable in that sub in order t...

How can I parse large XML files with Perl?

Possible Duplicate: Why am I getting an Out of memory error with Perl's XML::Simple? I have a XML file like this: <message> <c1> <rrcConnectionSetupComplete> <rrc-TransactionIdentifier>2</rrc-TransactionIdentifier> <criticalExtensi...

How do I underline text in Perl Linux?

Is there a way to underline the text is a perl output script? I have read from several sources but the text in the scripts can't be underlined. An error outputs: Global symbol "$finalAddition" requires explicit package name at C:\Documents and Settings\PCS\Desktop\Perl Scripts\script.pl line 7. The Script Codes: #!/usr/bin/perl use ...

How can I access .a library files in Perl?

How can I access .a library files in Perl? ...

Is my Fibonacci subroutine an example of recursion in Perl?

As we all know that we can send any number of arguments to a subroutine in Perl. Would the following example be a correct demonstration of recursion to display fibonacci series (5 values)? #!/usr/bin/perl -w use strict; sub recursion { if ($_[0] && $_[2]) { print $_[2],"\n"; if ($_[0] < 5) { return recursion($_[...

How do I install CPAN modules while using perlbrew?

I have started using perlbrew and installed perl-5.12.2. I understand I need to re-install my CPAN modules, so I switched to my new perl version (perlbrew switch perl-5.12.2 and hash -r), verified the switch was successful (perl -v) then tried installing some module (File::Copy::Recursive using cpan. However, cpan says `File::Copy::Rec...

How do I avoid printing to STDOUT when using Perl's `IPC::System::Simple:runx`?

I'm using IPC::System::Simple:runx to execute system commands and die on unexpected return values. The problem is that the commands output is printed to the shell. How can I avoid printing this output? How can I avoid printing this output but getting it into a perl variable? UPDATE 3) How can I print this output iff the execution fa...

How can I call a Perl script from PHP?

I am interested in knowing the ways we can call/run Perl scripts in PHP. ...

Old .pl modules versus new .pm modules

Im a beginner in Perl and I'm trying to build in my head the better ways of structuring a perl program. I'm proficient in Python and I'm used to the python from foo import bar way of importing functions and classes from python modules. As I understood in perl there are many ways of doing this, .pm and .pl modules, EXPORTs and @ISAs, use...

How do I parse a file using Perl's XML::SAX?

I am trying XML::SAX parser for parsing XML file. XML file is shown below, <message> <c1> <rrcConnectionSetupComplete> <rrc-TransactionIdentifier>2</rrc-TransactionIdentifier> <criticalExtensions> <c1> ...

In Perl, how can I print lines read from a file with optional leading whitespace removed?

#!/usr/bin/perl open(SARAN,"first.txt") or die "Can't Open: $!\n"; while($line=<SARAN>) { print "$line\n"; } close SARAN; Hi, In the above perl script, i need one functionality... in first.txt, each line starts with some space in front.. I need to print the lines without space in front... What to do. thanks.. ...

filter with grep to print when text is NOT present in another file

I have a linux filter to extract all lines from an xcode project that contain localized strings and produce a sorted list of unique entries. The filter works fine and is shown below. grep NSLocalized *.m | perl -pe 's/.*NSLocalizedString\((.+?)\,.*/$1/' | sort | uniq The result is a list of strings looking like this @"string1" @"st...

Checklist for going the Unicode way with Perl

I am helping a client convert their Perl flat-file bulletin board site from ISO-8859-1 to Unicode. Since this is my first time, I would like to know if the following "checklist" is complete. Everything works well in testing, but I may be missing something which would only occur at rare occasions. This is what I have done so far (forgiv...

How can I install Perl modules without root privileges?

I am on a Linux machine where I have no root privileges. I want to install some packages through CPAN into my home directory so that when I run Perl, it will be able to see it. I ran cpan, which asked for some coniguration options. It asked for some directory, which it suggested ~/perl "for non-root users". Still, when I try to install ...

How do I install the latest BioPerl version when using perlbrew?

I'm using perlbrew and I would like to install the latest bioperl version. Should I use cpanm or git? If git - do I just install as usual (AKA git clone ... then make and build), or should I do anything special? UPDATE Specifically, I'm not sure I understand the following expert from BioPerl Using Git manual: Tell perl where to fi...