Perl is a high-level, general-purpose, interpreted, dynamic programming languages with over 25 years of development. Perl 5 runs on over 100 platforms from portables to mainframes and is suitable for both rapid prototyping and large-scale development projects.  Perl gained widespread popularity as a Common Gateway Interface (CGI) scripting language, in part due to its regular expression and string parsing abilities. In addition to CGI, Perl is used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi all,

 How to compare string within an array? That string contains backslashes, colon and paranthesis.

sample program:

use strict;
use warnings;

sub perl_func {
    my ($z, $x) = @_;

    print "\n";
    print "z: $z\n\n";
    my @lx=@$x;
    foreach my $tx (@lx)
        if ($z !~ m|$tx|)
            print "$z !~ $tx\n";
            print "$z == $tx\n";
            return 1;
    print "\n";
    return 0;


#my @x = ("One", "Two", "Three", "Four", "Five");
#my $z = "Four";
#works fine for above x & z

my @x = ("One\\OnesPosition:Num (NumPerl)", "Two\\TensPosition:Num (NumPerl)", "Three\\HundresPosition:Num (NumPerl)", "Four\\ThosandsPosition:Num (NumPerl)", "Five\\TenThousPosition:Num (NumPerl)");
my $z = "Four\\ThosandsPosition:Num (NumPerl)";

if(perl_func($z, \@x))
    print "\nfound element\n";
    print "\nnot found element\n";
PMI ACP® Project Management
LVL 12
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.


I have a Perl question.

I have an input that is "x                               "   it is 23 characters and I will get a number to adjust the x character back or forward with in the 23 character field.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

I might get -4 which means I need to adjust back 4 and would make it

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

The problem is I am not sure how to program this.

I could get +5 or -10

Any help would be appreciated


Hi Everyone

I have a perl script and I have an array and am using a foreach and am looping many times to update an XML file.
There are 2 foreach loops in the script. The outer loop is the data and the inner is searching the XML file to add the data to the specific node.
I'm using the XML::LibXML to search and add.

My question is:

Once I use the element in the array I want to get rid of it to make the foreach loop execute faster as the array would decrease in size.

The program now runs 3 hours. It would be good to speed it up.

Is there an easy way to do this?

Thanks for the help

Hello Friends,

Is there any way to use floating point numbers in rrdtool? Some patch? Some RRDTool fork?

The reason for the question is that I would like to use the RRDTool to monitor balance / quote of cryptocurrencies...  For security reasons I do not want to use any existing tools for this... (yes, I'm a bit paranoid)  :)
I changed the top of the page from guestbook.html, addguest.html and guestlog.html
     <?xml version="1.0" encoding="iso-8859-1"?>  to   <?xml version="1.0" encoding="utf-8"?>
And also add
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
But some garbage value appears on the screen instead of Urdu ( Pakistani Language) .
Then I changed all encoding="iso-8859-1   to   encoding="utf-8" in but same garbage value appears on the screen instead of Urdu.
nms-guestbook is very attractive and I want to use it, so please help me.

 kindly check this link
I have a CVS file with thousands of lines and columns. I need to focus on column AM named or any column named  "EA-domain_list" in that row, I have several domains that are separated by commas in there.

Is there a way via perl, or some type of script that will feed this spreadsheet named master.csv in and take all the EA-domain_list that are in commas, and make new columns for each domain. Basically for example in summary

you look in the attached spreadsheet and look an AM you see,, I need what ever is in there to strip each domain into a new column like AS would be called EA-domain_list an in there would have, the another one row AT would have Keep in mind some times there are 20 of  then in there. So then I would like to spit out a new file called adjusted_domain_list.csv

Also, I am sorry I didn't mention previously that I am using a Macbook
Hi all,
I have a zonelist.txt file

In the file the contents are standard forward and reverse zones.  For example

I would like a bash or a shell script that uses dig to transfer each of the contents into individual files based on the zone and put them into a folder called transfer.

For example if I do a list in that folder I would have individual flies. For example

I use a Mac and I thought I could use
dig @ -f zonelist.txt

But that just shows them on screen and not in individual files.

Lastly. Is any zone transfer is refused or failes and or for any reason it does not get that zone to make a file called errors.txt
Yesterday I installed FreeBSD on a virtual machine with some web tools to use as a hobby webserver.
My project includes perl scripts, but when I try to run them in my browser a get the whole script shown as a text, instead of getting executed as a program.
So I did some digging and found that I had to do some CGI configuration. So I added the line AddHandler cgi-script .pl to /usr/local/etc/apache24/httpd.conf, and I added the line Options ExecCGI to the apache server directives. I fiddled around with this for hours and still can't get it to work. What am I doing wrong?
I am using a web interface for the server called webmin, if that could be of importance.

Thank you for helping!

I have a large XML file and I need to remove the line
<INCOND NAME="A-OK" ...... />  or <OUTCOND NAME="A-OK" ...... />

in it if the line matches an entry in an Array (@LIST)

The array is @LIST with entries

The entry from the @list could contain special characters.

There could be multiple line in the XML file with the same pattern.

I need to make it fast as possible.


Hello Team,

Require a shell/perl script with below steps.
1) When disk space reaches 75%, trigger a cron job and move the old .arc files to another location.
2) Clean up the files in a folder by keeping only 8 hours of data available and it should be run every 15 mins.

CompTIA Cloud+
LVL 12
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Hi All,

We have recently upgraded our Aix OS from 6.1 to 7.1, along with the Os the perl fileset got upgraded to 5.10.1 from 5.8.8, now we are getting the below issue.

Can't locate in @INC (@INC contains: /usr/opt/perl5/lib/5.10.1/aix-thread-multi /usr/opt/perl5/lib/5.10.1 /usr/opt/perl5/lib/site_perl/5.10.1/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.10.1 /usr/opt/perl5/lib/site_perl/5.8.8 /usr/opt/perl5/lib/site_perl .) at / line 3.
BEGIN failed--compilation aborted at / line 3.

Can someone please help me to resolve the issue.

I'm thinking to reinstall the older version of perl i.e., 5.8.8, but I'm not sure if it works or not. And I couldn't even find if the 5.8.8 is still compatible with the Aix 7.1 TL 4 SP4. Thanks.

I have a perl app that is currently connected to a MYSQL Database, but we would like to migrate the app to a sql server database. A page in the app executes two queries, the 1st is the primary and the second  gets its filter value from the 1st. The problem i'm having is, only the last row from the 1st query being executed in the second query. For instance if the 1st query returns the following
CrsNo   |Customer  | Response
723         Bill                  Urgent
724         Ken                 Urgent
725         Bob                 Urgent

The second query should query the database for each customer number that the first query provided, however, the only query that is executed is CrsNo 725. I have confirmed this with the sql profiler. The odd thing is the same code works fine with MYSql, I only run into this issue with sql server. Below is PERL Code and sql queries.
################## First Query

my $str = "select  distinct q.CRSNo,q.CustomerName,q.ResponseAction,
                           from crs.tbl_customer q
                         where q.CustomerName = '$cname' order by q.CRSNo";
my $temp1 = $dbh->prepare("$str");

while (my @aray = $temp1->fetchrow_array)
($crsno,$crscust,$response) = @aray;

################Second Query
$str2 = "select q.DepartmentInitial,q.ReviewStatusName
                                       from crs.tbl_department as q
                                       where q.CRSNo ='$crsno'  order by q.DepartmentNo";

$#dpt = -1;
      $#dptresp = -1;
      $temp2 = $dbh->prepare("$str2");

Hello ,

I need to write a script that reads the mark & masqueraded packets and for every 1/2 of a second it will ask to backend and reply the same answer to each question that comes from udp.
For ex.
Tsource is a counter strike packet. S.b. is making spoofed traffic of tsource , i want to masquerade this traffic to my perl module with marking packets with the destination ip. My script will see the mark and ask to the backend the answer of Tsource. and will answer this packet same for every half of second .
This samples should be given more like teamspeak TSINIT or other udp apps. Is that possible ?

If i block the tsource packet all the server is locking down , there is no logical solution like droping first packet (because the attacker sending 2 packets to server)  or blocking flood (because a companies all servers getting tsource at least once for giving game information , if i block floods for a number this time game lists are closing) . I need to find a way to build a proxy for this kind of application firewall proxies.
An Application running on linux executes perl scripts in the background which connects to MSSQL database running on Windows Server. In order to connect Linux server to Windows Database server Microsoft ODBC driver needs to be installed so I have installed UnixODBC  version 2.3.0.
So when I'm going to execute the perl script it throws an error (See below)

DBI connect('DRIVER={SQLServerNew};;Database=Faxing-Test','M36097',...) failed:

[unixODBC][Driver Manager]Can't open lib 'SQLServerNew' : file not found (SQL-01000) at ./ line 104.

Can you please look into the issues since last two months I'm trying to resolve however no luck.

I need help in perl script where i will be reading data from csv file and loading in to oracle database.
This is my very first experience with perl script.
 Pls help!

I currently login to the time from website using the following script.

browser = webdriver.Chrome('E:/Shared Folders/Users/runnerjp/chromedriver/chromedriver.exe')
username = browser.find_element_by_id("EmailAddress")
password = browser.find_element_by_id("Password")
login_attempt = browser.find_element_by_xpath("//input[@type='submit']")

Open in new window

it works but I find using Chrome web driver is hammering my CPU. Is there an alternative code I could use that does not mean I need to physically load the page to sign in?
I had this question after viewing adding leading zeros and trailing zeros.

I have the following:

C  --------------                                                                                                                                                                                    
P  IMAGE PANEL                                                                                                                                                                                        
C  --------------                                                                                                                                                                                    
C  ALIGN BOARD RECORDS :   # I need to match this pattern                                                                                                                                                                          
C                                                           …
Can you please give me the unix permissions for Today In History?  I have purchased the CGI/Perl Cookbook and spoken to Craig Patchett and he told me they were in the code section, but I could not find them, as it was not listed.  I'd appreciate it very, very much!
Warmest Regards,
Matt Mattero
I work on an ubuntu Box in my company. I have limited Admin rights. I am behind firewall and proxy. cpan and cpanm not working. Need to be able to load packages and install manually on the box.
I can install on my windows personal and move the corporate box.

Can you give me directions?
OWASP Proactive Controls
LVL 12
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Hello experts,
I have a perl script that does the following::
-get log files from a directory;
-zip them
-send them over smtp to a given mailbox
-redownload them from the mailbox
-crypt them using pgp
-crypted files gets pushed on ftp
-delete the original file

What i would like to do is:
-Delete the ftp sending part, instead move the files in a local given directory

Attached you will find the script.

Thank you in advance!!!!
I have stored all my passwords in a text file.Now i want to encrypt the text file containing password for question is how to encrypt the password file so that later i can easily read passwords out of it and validate through perl
I need a perl that will list down all the files in the given folder and its subfolder that are modified 'x' minute ago say (20min ago) compared to localtime or system time.Please help me out if you have any idea of how to do this because I am very much new to perl.

I have a script that I am executing and need to get the full value for a child.

<?xml version="1.0" encoding="ISO-8859-1"?>
<DEFTABLE xmlns:xsi="" xsi:noNamespaceSchemaLocation="Folder.xsd">
  <SMART_FOLDER DATACENTER="DEV" CREATION_DATE="20170406" CREATION_TIME="113155" FOLDER_NAME="AAA_TEMPLATE" USED_BY_CODE="0" ADJUST_COND="N" FOLDER_ORDER_METHOD="" APPLICATION="CRITICAL" RUN_AS="DEFAULT_RUN_AS" CREATED_BY="DEFAULT_CREATED_BY" CONFIRM="0" CRITICAL="0" JOBNAME="AAA_TEMPLATE" SUB_APPLICATION="BATCH" DESCRIPTION="== Conversion Messages Start ==&#13;&#10;&#13;&#10;Message ID&#9;: INF11004 (2-5)&#13;&#10;Description&#9;: An empty RBC is added..&#13;&#10;&#13;&#10;== Conversion Messages End ==&#13;&#10;New Chain Template" TIMEFROM="" TIMETO="" PRIORITY="U7" CREATION_USER="5" PLATFORM="UNIX">

Code is


  use XML::LibXML;
  my $filename = "$ARGV[0]";
  my $dom = XML::LibXML->load_xml(location => $filename);

  foreach my $smart_folder ($dom->findnodes('/DEFTABLE/SMART_FOLDER')) {
      print $smart_folder->getAttribute('FOLDER_NAME'), ":::";
      print $smart_folder->getAttribute('JOBNAME'), ":::";
      print $smart_folder->getAttribute('DESCRIPTION'), ":::";
      print "\n";

output is

AAA_TEMPLATE:::AAA_TEMPLATE:::== Conversion Messages Start ==

Message ID      : INF11004 (2-5)
Description      : An empty RBC is added..

== …
We are having 1 perl script that run as windows service and its task is to update VM Virtual NIC Card in every 10 seconds.This period is fed to acript by some eternal .DAT file.
The to get the status of the NIC Card in every 10 seconds, it logs in and logged out to and from VM HOST.And we observer frequent failure in that (from VM Host log (hostd.log), we can see the same.The Perl script uses the vSphere Credential Store Subroutine module as depicted below.
VM Get NIC card status  

The problem is when ever there is a failure in log in , I am not able to monitor the NIC status and it happens very frequently.
VM Ware Esxi version is 6.0.0

Is there any remedy of the problem? The below is the logs captured from hostd.log file.
2017-03-01T18:56:09.571Z info hostd[31301B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=9b80d4e2 user=root] Event 656195 : User root@ logged out (login time:Wednesday, 01 March, 2017 18:56:04, number of API invocations: 0, user agent: VI Perl)
[module:pam_lsass]pam_do_authenticate: error [login:root][error code:2]
[module:pam_lsass]pam_sm_authenticate: failed [error code:2]
[module:pam_lsass]pam_do_authenticate: error [login:root][error code:2]
[module:pam_lsass]pam_sm_authenticate: failed [error code:2]
I am new in this environment. Need to create a monitor which will monitor the queue size of different topic og ActiveMq  and if queue size more than we expected to we need trigger the nagios to send some kind notification . Tool we can use is jmx4perl, check_jmx4perl.
Your guidance will  be appreciate
Your inputs will be highly appreciate.







Perl is a high-level, general-purpose, interpreted, dynamic programming languages with over 25 years of development. Perl 5 runs on over 100 platforms from portables to mainframes and is suitable for both rapid prototyping and large-scale development projects.  Perl gained widespread popularity as a Common Gateway Interface (CGI) scripting language, in part due to its regular expression and string parsing abilities. In addition to CGI, Perl is used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications.

Top Experts In