Category "perl"

how to implement odd numbers in a new array?

I want to output only the odd numbers from an array with the numbers from 1-100 in a new array. I have no idea how to do this. use strict; use warnings; my @z

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Login failed for user 'sa'

I am trying to execute one stored procedure using 'sa' user through perl script save this line in a perl file and execute that perl file system("start /wait s

invoking a stored procedure with input parameter and out cursor in perl script

Trying to execute a procedure in perl script, Proceure ->create or replace PROCEDURE Getproc ( v_catg IN CHAR DEFAULT NULL, v_cursor OUT SYS_REFCURS

Convert Outlook htmlrtf to html in perl

I managed to extract the RTF part from an Outlook .msg using Email::Outlook::Message. Here's how it looks: {\*\htmltag84 <b>}\htmlrtf {\b \htmlrtf0 {\*\ht

Allow CORS with Mojolicious::Plugin::SecureCORS

I am new to Mojolicious and using plugins especially SecureCORS. How can I allow CORS on POST requests? I managed to allow CORS for GET with following lines: us

Decrypt obfuscated perl script on hacked site

I was cleaning out a client's site that got hacked after I had cleaned it once already, when I found a cron job pointing to a script in the server /tmp director

perl match nested regex and write back to file

I have a txt file and I would like to match a certain pattern and convert a numeric field from decimal to hex and write back existing file using perl. Before Wi

How to directly assign the SOLE hash key to a scalar in perl

Is it possible to assign the only existing hash key directly to a scalar? For example can these two statements be combined into one? @the_keys = keys %the_hash;

enable vi command line editing from .perldb rc afterinit in perl debugger

Whenever I start the perl debugger from a script with a -d option, the session starts with emacs command line editing. I then type ESC ctrl J to enable vi edit

perl: Finding mean and variance of large numbers without overflow

I am using a subroutine (stats) to calculate statistics for a list of numbers. These numbers may be big enough to lose precision if stored as normal perl number

How do I remove the special characters within multiple lines in Regex?

I'm trying to solve a problem that wants to display the given text from a file omitting the special characters and modifying the multi-line input to a single-fo

Perl: Multidimentional arrays and "experimental push" error

I'm a junior perl programmer and have very little experience with multidimentional arrays. I'm not even sure it is the proper data structure for this project. I

How to open a filehandle with an existing variable in perl?

In my Perl script, I would like to process lines from either STDIN or a given file, if specified, as common with Linux/UNIX command line utilities. To this end,

Handle multiple arguments to a Perl subroutine [closed]

As i have read ,"There’s another problem with this subroutine.This subroutine works properly only if called with exactly two Excess

IPC::Run - Detection of premature child exit and closed pipes

I would like to use IPC::Run to communicate with child via child's STDIN, STDOUT and STDERR (start, pump, finish). It seems to work. I would like to know how

Test two boolean values with AND operator in Perl

I want to test two boolean values in Perl. In case both are 0 do x, in case not do y. For example: $var1 = 0; false in Perl $var2 = 0; false in Perl if($var1==0

How to read HASH(0x1fcb970) using perl?

I'm really lost with this, how can I read this response form an API HASH(0x1fcb970) using perl. my @info= $connection->fetchrow(); When I try to print the d

Counting dictionary elements from Perl to Python

Looking for a best way to translate this piece of code from Perl to Python: my @arr = (); # [ 0 , 1 , 2 , 3 ] push @arr ,[$time,$host,$stat

Print the missing number in a unique sequential list with an arbitrary starting range or starting from 1

This question is similar to How can I find the missing integers in a unique and sequential list (one per line) in a unix terminal?. The difference being is that

Parsing HTML on the command line; How to capture text in <strong></strong>?

I'm trying to grab data from HTML output that looks like this: <strong>Target1NoSpaces</strong><span class="creator"> .... <strong>Targ