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";
HTML5 and CSS3 Fundamentals
LVL 12
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

what is the perl regular expresssion to compare "machinename\\username" in perl scripts?

sample code:
print "Hello World!\n";
$user = "test";
$mu_reg = "^(?i)$mname/\/\$user \$";
$mu_str = "164AUTH/\/\chris";

$ipstr="$mu_str ";
$ipstr_re = "^(?i)mu_reg \$"; # regex failed with two backslashes. How to fix it?
if ($ipstr !~ /$ipstr_re/) {
    print "It doesn't match\n";
else {
    print "It matches\n";
Code is here:

my $a1 = ‘a1_v’;
my $c1;
my $varName;

my $code = qq(
      \$varName = ‘a1’;
      eval(‘\$c1 = \$\$varName;’);


# I hope this line print a1_v, but print nothing
print “$c1\n”;
When we get threat intels info for hashes to be added to Trendmicro
Officescan, the MD5 or SHA1 hash value has to be entered into an
IOC Editor (we use Mandiant's ie
 to generate 2 values indicated by 1st value & 2nd value enclosed in "...'  below.

However, sometimes, the intel that comes in can be more than a hundred, so this makes
it very tedious to manually generate the values & populate into the IOC file for Officescan
to read in.  Is there an automated way / script to generate the 2 values for each hash &
auto-populate (using script etc) or an easier way for Officescan to read in just the hash
values?    Have logged a case with Trendmicro & was advised to do it manually which
does not help at all.

attached the full IOC file.

   Sample IOC file's content:
<?xml version="1.0" encoding="us-ascii"?>
<ioc xmlns:xsi="" xmlns:xsd="" id="2146113a-1513-4be6-b07e-f43969847a6a" last-modified="2018-12-02T02:19:17" xmlns="">
  <links />
    <Indicator operator="OR" id="a1c825b0-ae7f-4461-85dd-25a20720acac">          <== 1st value enclosed in "...";  once only for entire IOC file
      <IndicatorItem …

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


Enroll in these five web development courses: RESTful Services: Data, JAX-RS and Jersey, RESTful Services: Fundamentals, Selenium Fundamentals, Bootstrap 3.1: Fundamentals, and Perl Fundamentals. Then learn to perform data analysis in Microsoft Excel to measure your success.

Administrative Comment

by:Stacy Richard
Comment Utility
Published for Nicole
Nagios Core 4.3.4
Nsclient 4.3
Windows 10

Just restarted my Windows 10 Desktop VM after November Updates and Nagios reports this warning on two checks

 Error: Can't locate perl510.dll

Check Windows Temp Folder WARNING 11-14-2018 22:01:47 0d 0h 32m 58s 10/10 Error: Can't locate perl510.dll

Explorer WARNING 11-14-2018 22:28:58 0d 0h 33m 34s 20/20 Error: Can't locate perl510.dll

I have the exact same checks on other Windows 10 VMs and Physical Windows 10 Desktop and they all work

I have no perl program installed on any of y computers

Searching for this dll shows nothing any where.

Any ideas?
Hi, we have a gift certificate form.  - cart is written in PERL,

In the amount window, if someone enters a dollar sign before the number, they get an error. Error: Invalid input for VALUE: $|$35|

Is there a simple way to remove the $ sign if someone enters it, as the form is submitted? Or is there another simple solution?

As an interim measure, I'll be changing the placeholder text. Thanks.
On a new RHEL 7.5 server, I'm trying to get mod_fcgid to run on a simple perl script. I had previously been using mod_perl on an older server, with no issues.  I have confirmed that fcgi_module is installed and running. Server is Apache 2.4.6.

AddHandler fcgid-script .fcgi

print "Content-Type: text/html\n\n";
print "hello world";

Error log:
[Fri Oct 12 17:33:50.655808 2018] [fcgid:warn] [pid 13551] (104)Connection reset by peer: [client] mod_fcgid: error reading data from FastCGI server
[Fri Oct 12 17:33:50.655891 2018] [core:error] [pid 13551] [client] End of script output before headers: hello.fcgi

In a file I need to have the possibility to grep a pattern in the first or in the second column.  If found the entire line is returned.
Comes with it that that pattern is a variable.

Grepping the var in the first column is easy, but I can't get it to work for the second column (sep is >).



This is what would need to be returned:


Thank you for  your help.
C++ 11 Fundamentals
LVL 12
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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)  :)
In my current Perl script I want to modify a string that identifies my database RAC zone cluster.  Currently using:  nslookup `hostname` to get my fully qualified hostname.  However, this is not the name I need to use for my network administration HOST string in my "tnsnames.ora" file.  So, please help me modify this string:
       An example   dbserver01.dpsn.local  -->  need this string to be  dbzonecluster.01.dpsn.local

In general I will always want to replace what comes before the first '.' character in the file with some predefined string.  Can't figure out how Perl function substr would help, or something like  $myZoneClusterName =~ s/xxxxx/yyyy/g
My plan is to automate our current Database STIG Audit process.  I want to write a short Perl script to:

   1)  Read XML STIG File (i.e.  U_Oracle_Database_12c_V1R10_Manual-xccdf.xml)
   2)  Parse out all the STIG #s, with the accompanying SQL Query Statements
   3)  Write new ascii text output to new file

Please help me with Perl file example to do this parsing?
I had this question after viewing Unix AIX compare column of 2 files.

Hi Experts,
I try to make these lines work:

while read LINE ; do
FileSystem=`echo $LINE | awk '{print $3}'`
GrowthTreshold=`echo $LINE | awk '{print $5}'`
if [ "$GrowthTreshold" -ge 0 ] 2>/dev/null  ; then
echo $GrowthTreshold
perl -ane '$k=$F[0].$F[2]; print if exists($h{$k}) && $F[3]-$h{$k}>='$GrowthTreshold'; $h{$k}=$F[3]' $file1 $file2 >>ExceptionList.txt
echo ""$FileSystem" could not be checked"
done <$file1.txt


I attach a file1.txt and a file2.txt

Values of file2.txt are compared to those of file1.txt
In this example:
- the first line is one that should be logged: 78 to 88 = 10 so that exceeds the allowed growth treshold of 5
- and also the last line: 34 to 40 = 6 so that exceeds of the allowed growth treshold of 5

When I run the script as it is now this is returned:

syntax error at -e line 1, near ">=;"
Execution of -e aborted due to compilation errors.

Thank you for your help.
I'm trying to ingest a large text file into PostgreSQL Full details here

I may need to run  a script against the file to either remove the problem rows into a separate file, or insert into the database via DBI and was wondering how perl handles diacritics?

I'm sure perls native I/O file handle is UTF8 but not certain about the diacritics or non roman characters
I need to run multiple sql queries (These are built elsewhere in the script  with no possibly why of introducing SQL injection)

Rather than writing multiple prepare /   execute statements I thought about  using a foreach loop something like bellow but I get error
Use of uninitialized value $sql in concatenation (.) or string at line 19.

Any idea how I might do this?

use strict;
use warnings;
use  DBI;
my $dbi = DBI->connect('DB Connection string', {
    PrintError =>0;
    HandleError => "OH No!"}
)or print DBI->errstr;
# built elsewhare
my $Q1 = "insert into my_table 'ABC'";
my $Q2 = "insert into my_table 'EFG'";
my $Q3 = "insert into my_table 'XYZ'";

   my $sql = $1; 
    print $sql . "\n";  # line 19
#    my $qa = $dbh->prepare($sql);
#    $qa->execute();
#    if(defined(DBI->errstr)){
 #       print DBI->errstr . "\n";
  #  }

Open in new window

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

how to parse this in perl
Why Diversity in Tech Matters
LVL 12
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

how to compile 64 bit version of libperl.a from perl 5.28 source code on solaris.

Tried with -fPIC while configuring. But, no luck.

I am setting up the first MySQL cluster and I need to install the auto install rpm first, but that one said it depends on community server rpm first, which asking for the client to be install, but when I install the client it complain:

when installing MySQL client
so how can I get ride of that error when installing the client?

what is perl (Class::MethodMaker) ? how to install it?

I download all component from

and now the files list is:

MySQL  Cluster binary downloaded.
anything missed?
Hi experts,

Need help on how to convert a string of values in both 2nd and 3rd fields that are actually Date and Time in GMT and then calculate the difference in seconds.
Preferably using the following scripting methods:  BASH or PERL

Sample source file in CSV:  inputfile.csv


Open in new window


Required Output File: Start and End Date/Time in GMT+8, plus the Date/Time difference or Duration (in seconds) inserted as a new column (4th field)

Output CSV File:  outputfile.csv


Open in new window

I'm migrating my website to a secure server, and a certain cgi script is not being found when it is needed.  I've attached an excerpt from the server's error log, specifying what happened.  I don't know how to interpret this error log text, or how to remedy the issue.  The script which isn't being found is properly situated in the cgi-bin folder.Error-loading-SecureForm.txt

A cgi script that was functioning properly when accessed via IP address, is currently not working when accessed via domain name (now that the nameservers have propagated.)
Instead it is producing a message to open or save the cgi file.

I have checked the scripts in cgi-bin and the permissions are all correct 755.

Thanks for your help.

I have 2 arrays and in one there is data that matches the x lines that are in the other array.

how can I delete the data that matches exactly from the other array.

@A = qw ( AA,
                   EE );

@B = qw( DD,
                  EE );

So I need to delete the DD,EE from @A. And in that order of DD,EE.








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