Perl

25K

Solutions

11

Articles & Videos

10K

Contributors

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

I have xlc compiler version 8 and perl 5.10 running on AIX 7.1. I have been able to install DBI.pm module successfully, but now am in need to install DBD::ORACLE module. The oracle version is 12 (64bit)

perl Makefile.PL runs fine for the DBD::ORACLE module, however the "make" command is throwing below error:
I attempted to fix the issue by changing the object mode value, but that end up giving a different type of error.
Can you advise on the solution ?

#make
        rm -f blib/arch/auto/DBD/Oracle/Oracle.so
        LD_RUN_PATH="/u01/app/oracle/product/12.1.0/client_1/lib:/u01/app/oracle/product/12.1.0/client_1/rdbms/lib" ld  -bhalt:4 -G -bI:/usr/opt/perl5/lib/5.10.1
            /aix-thread-multi/CORE/perl.exp -bE:Oracle.exp -bnoentry -lpthreads -lc -lm -L/usr/local/lib Oracle.o  dbdimp.o  oci8.o /lib/crt0_64.o -bI:/usr/lib/iocp.
            exp  -o blib/arch/auto/DBD/Oracle/Oracle.so     -L/u01/app/oracle/product/12.1.0/client_1/lib/ -lclntsh -lclntshcore -lld -lm -ldl -lc -lm -lpthreads -
            lodm
            -lbsd_r -lld -lperfstat -lm -lpthreads
ld: 0711-736 ERROR: Input file /lib/crt0_64.o:
        XCOFF64 object files are not allowed in 32-bit mode.
make: The error code from the last command is 8.

#bootinfo -K
64

#ORACCENV='cc=xlc_r'; export ORACCENV

#export OBJECT_MODE=64
#make
        rm -f blib/arch/auto/DBD/Oracle/Oracle.so
        LD_RUN_PATH="/u01/app/oracle/product/12.1.0/client_1/lib:/u01/app/oracle/product/12.1.0/client_1/rdbms/lib" ld  -bhalt:4 -G …
0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I recently upgraded AIX from 6.1 to 7.1, which resulted in perl getting upgraded from 5.8 to 5.10 as well and in process i no longer have a dbi.pm module under perl 5.10.

I have been unable to find binary version for dbi.pm for perl 5.10 so i am trying to compile it but running into an issue with it.
I am using steps of running perl Makefile.PL, make, make test, make install to compile.
I am able to successfully run perl Makefile.PL from the dbi.pm directory that i saved in /tmp from cpan.org, but when i run the "make" command, i get following error.

Skip blib/lib/DBI/ProfileData.pm (unchanged)
        xlc_r -q32 -c    -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -qlanglvl=extended -I/usr/local/include -q32 -D_LARGE_FILES -qlonglong -O    -DVERSION=\"1.636\"  -DXS_VERSION=\"1.636\"  "-I/usr/opt/perl5/lib/5.10.1/aix-thread-multi/CORE"   Perl.c
/bin/sh: xlc_r:  not found
make: The error code from the last command is 127.

I do have xlc compiler installed.
  vac.C                      8.0.0.0  COMMITTED  IBM XL C Compiler
  vac.C                      8.0.0.0  COMMITTED  IBM XL C Compiler
  vacpp.cmp.core             8.0.0.0  COMMITTED  IBM XL C/C++ Compiler
  vacpp.cmp.core             8.0.0.0  COMMITTED  IBM XL C/C++ Compiler
  xlC.aix61.rte             12.1.0.3  COMMITTED  IBM XL C++ Runtime for AIX 6.1

/usr/vacpp/bin/xlC -qversion
IBM XL C/C++ Enterprise Edition V8.0 for AIX
Version: …
0
Hello

I have list of data

345 654 345 432 236
345 654 345 432 236
345 654 345 432 236
654 345 345 432 236
654 345 345 432 236
654 345 345 432 236
710 654 345 345 436
710 654 345 345 432
710 654 345 345 433
710 654 345 345 433
710 654 345 345 433

through which I need to find repeat entries row on row, over about one million rows.

Manually I have to take the first row and check for a repeat of any of the values of that row with the next row. If there are any repeat values, then I have to mark down how many. Then I move onto the next row and repeat the process.

I then have to tally how many rows had whatever number of repeated values.

so the out put would look like

4
4
4
0
2
2
3
3
4
4
(for each row)

total

0 values were repeated on 1 rows
2  values were repeated on 2 rows
3   values were repeated on 3 rows
4   values were repeated on 5 rows

Could someone help me for code with this, output to a VIM file please ?
0
Hi Experts,

Im trying to convert a series of scripts that we use internally to a vb.net applicaiton with a GUI that can be passed on to the BAU teams. Unfortunately my knowledg around encryption is pretty non existant.

Would anyone be so kind as to explain to me how to convert the below perl to VB.NET? Or at least point me in the correct direction as far as namespaces etc are concerned?

use DBI;
use strict;
use warnings;
use Crypt::CBC;
use MIME::Base64;
use Encode;
use Digest::MD5 qw(md5_hex);
use warnings;


my $encrypted = <FILE>;

my $iv  = '0000000000000000';
my $utf_decoded = encode_utf8($iv);
my $key = "854EE3617FDDA2D3";


#create Cipher based on AES
my $cipher = Crypt::CBC->new(
				-key => $key,
				-literal_key => 1,
				-iv => pack('H32',$utf_decoded),
				-header => 'none',
				-padding => 'standard',
				-blocksize => 16,
				-keysize => 16,
               -cipher => "OpenSSL::AES"
);

my @dec = decode_base64($encrypted);
my $count = 0;

foreach my $entry (@dec) {
	my $temp = $cipher->decrypt($entry);
	$temp =~ s/[\x0D]//g; 
	$count++;
	print "$temp";
}

exit();

Open in new window



Here is what i have so far.... not going so great.

Public Function AES_Decrypt(ByVal input As String)

Dim KeyStr As String = "854EE3617FDDA2D3"
        Dim IVstr As String = "0000000000000000"
        

        Dim IV(15) As Byte
        For I = 0 To 15
            IV(I) = IVstr.Substring(I, 1)
        Next

        Dim AES As New RijndaelManaged
        Dim Hash_AES 

Open in new window

0
Im runinnig a linux server
although my qmail queu was very quite I was listed in more than 10 blacklist sites for sending spams. then from my tcpdump I saw that there is hundreds of perl processes owned by apache  user making thousands of smtp connection. however I could not locate this perl script.
is there a way to find the full path of what this perl is runinnig?
0
I have a file with a character that translates into 272 when I do:
od -xc

The character looks like an A with a caret on top with a degree sign to the right. I am attaching an image of the character as well. I have tried sed, perl and tr and none of them are working.

For example:
sed -e 's/'$(echo "272")'/ /g' input_file > output_file

This does not work.

Any suggestions?
Image.jpg
0
I am new to perl and need some help in doing the following:

I have the following:
#P 0.725 22.425
#P 17.275 22.175
#P 17.275 1.575
#P 0.725 1.575

I need to add a leading zero for numbers that are less than two digits before the DOT  and add trailing zeros to the number to add a total of six digits after the DOT. Output should look like the following:

#P 00.7250 22.4250
#P 17.2750 22.1750
#P 17.2750 01.5750
#P 00.7250 01.575 0
Thanks for helping
0
I need an example of Perl using sqlite3 for a database in Memory and then writing it to disk afterwards. Later reading it from disk to convert it to in memory
0
"Search Time": "2017-05-08 15:03:20.561",

my $t = Time::Piece->strptime($searchTime, "%Y-%m-%d %H:%M:%S");

I get an error saying
garbage at end of string in strptime: .124 at C:/Perl64/lib/Time/Piece.pm line 481

I am using ActivePerl in Windows. There are packages that I could not install like Time-modules. Actually, I am having so many issues with new packages to install. I need a solution that might not require specific packages as I can get stuck.

perl -v

This is perl 5, version 24, subversion 1 (v5.24.1) built for MSWin32-x64-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2017, Larry Wall
0
I just got EE's help to make copies of an svg file with Perl.  How do I make inkscape automatically open an svg file when I double click it?
array.txt
0
Free Tool: Path Explorer
LVL 8
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

I declared an array in perl using the "strict" and "warnings" pragmas.  I annoyingly had to explicitly declare EACH member of the array because I didn't see any pattern in the cemetery lot numbers.  Around element 102 I added a fake value for a lot number (it's clearly marked) just to declare the element.  If I comment or uncomment this line Ige "undeclared variable" warnings.  I'm getting confused.  I think the code is almost there but I'm missing something.
arrays.txt
0
is there a macro that would delete row 2 in every file in a windows folder? these are CSV files - so i suppose i will need to convert them all to excel as well.
0
I have a file with times in it.
Example:  Time = 05:02:22.
I want to know how to replace that time using the variables hours, min, sec using perl/regex.
(those variables will have updated times potentially in them).
0
I am trying to take the advice of fishmonger (make my code use an array)
Even though I'm slowed because I forgot alot of vi, here are my:
1) Perl script
2) screen copy of error screen when I use my alias "'r" to run "perl array.pl"
arrays.txt
octalPic.png
0
Can someone explain the following Perl invokation of unlink, and how do I expand to also do files withing multiple sub-direcories.
0
Hi
We used to use CentOS 5 with Sendmail, MailScanner and Sophos SAVI (Perl module) to scan mail virus.
As EOL of CentOS 5, I build the mail server on CentOS 7 instead.

My MailScanner doesn't work with SAVI mode (use less CPU resource), just work with Sophos mode (user more CPU resource).

I have complied the SAVI-Perl-0.30 and the after "make" the SAVI.so has been deployed to /usr/local/lib64/perl5/auto/SAVI/SAVI.so.

I set "Virus Scanners = sophossavi" in MailScanner.conf, let it make use SAVI module.
However I got the following error in maillog, keep saying "SAVI Perl module not found"

Apr 20 15:07:56 myserver MailScanner[5266]: MailScanner E-Mail Virus Scanner version 4.85.2 starting...
Apr 20 15:07:56 myserver MailScanner[5266]: Reading configuration file /etc/MailScanner/MailScanner.conf
Apr 20 15:07:56 myserver MailScanner[5266]: Reading configuration file /etc/MailScanner/conf.d/README
Apr 20 15:07:56 myserver MailScanner[5266]: Using SpamAssassin results cache
Apr 20 15:07:56 myserver MailScanner[5266]: Connected to SpamAssassin cache database
Apr 20 15:07:56 myserver MailScanner[5266]: Enabling SpamAssassin auto-whitelist functionality...
Apr 20 15:07:58 myserver MailScanner[5266]: SAVI Perl module not found, did you install it?

If I set  "Virus Scanners = sophos" in MailScanner.conf, it works, but use a lot of CPU and performance is not good.

In the MailScanner.conf, seems no conf to tell the …
0
I have 2 files that I need to compare and merge. File1 has 3 fields: device_name, status, days_in_cur_status. File1 is the "master status" file.

File2 has 2 fields: device_name, status. File2 is the file produced from checking the current status.

- File1 -
deviceA available 10
deviceB available 8
deviceC unavailable 3

- File2 -
deviceA available
deviceB unavailable
deviceC available
deviceD available

After comparing/merging the files I'd like to produce File3 which should look like:

deviceA available 11
deviceB unavailable 0
deviceC available 0
deviceD available 0

I can't figure out how to open both files and compare a line in file1 to each line in file2. I began by reading both files into an array and then iterating through the arrays, but that's not working. I'd be glad to post the code, but I'm pretty sure that having to read thru file 2 once for each line in file 1 is, well, dumb.

Help?

Thanks,
Steve
0
Hello,

I need to send config commands to network equipment that only has Telnet. No SSH, no API available.
The commands are Cisco-like:
Login: xx
Password: yy
User> enable
Password: zz
switch_name# cd gpononu
switch_name/gpononu# set something enable
<it should return "OK - something enabled" here. Anything else means failure.>
switch_name/gpononu# cd ..
switch_name# quit

Open in new window


This needs to be available "on click": go to an internal website, click on a link and the commands will be sent to the switch.
Depending on the result, it should return an "OK" and the string from the switch output or "Fail".

The internal website is hosted on a Linux box, with PHP, Perl, Python, Expect available. I can install additional packages, if necessary.

I've played a bit with PHP fsockopen. No luck after login.

Tried recording with autoexpect, the result is full of stuff like "ESC\[mnESC\[2DESC\[mESC\[36mdn".

Anyone has a working example written in something that I can run in Linux?

Thank you.
0
this script pick up a file and steps through it, and then picks up another file and matches the item number to merge the file and i getting this error, and I do not know why ?

here is the code where the file is blowing up with the following errors repeatedly.

<Error>
substr outside of string at ./parseOsc.pl line 272, <PLUS> line 745800.
substr outside of string at ./parseOsc.pl line 273, <PLUS> line 745800.
Use of uninitialized value $bo_plus in substitution (s///) at ./parseOsc.pl line 283, <PLUS> line 745800.
Use of uninitialized value $res_plus in substitution (s///) at ./parseOsc.pl line 284, <PLUS> line 745800.
Use of uninitialized value $res_plus in string eq at ./parseOsc.pl line 286, <PLUS> line 745800.
Use of uninitialized value $bo_plus in string eq at ./parseOsc.pl line 287, <PLUS> line 745800.
</Error>

<code>
while(<PLUS>) {
     $the_plus = $_;
     chomp($the_plus);
 
     $item_plus = substr($the_plus, 0,10);
     $bo_plus   = substr($the_plus,36, 5);
     $res_plus  = substr($the_plus,41, 5);

   next if $item_plus =~ m/\s*MSC/i;
 
     $item_plus =~ s/\s+//;
     next if $item_plus eq "";
 
   #print " $item  >$item_plus< \t $bo_plus  \t $res_plus \n";
 
   $bo_plus  =~ s/\s+//; ### Error happens here !!!
   $res_plus =~ s/\s+//; ### Error happens here !!!


         $res_plus = ($res_plus eq "" ) ? '0' : $res_plus;
        $bo_plus = ($bo_plus eq "" ) ? '0' : $bo_plus;
 
        next if ( $item ne $item_plus);
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

how to do the following from command line:
read a file start file is like that
scan id 123
difference
only 2 line then check if the second line is difference then variable scan in second file is 123

if start file like
scan id 123
no difference do nothing.
0
I've posted this as a question as it started out as a final comment to an answered question and grew too big, from here:
perl-suggestion-instead-of-awk (see last couple of comments)


hmmm... ! I just spent days getting to loose grips with awk.. What's the command to fire up perl? I think really it's too late for this little project. I was not aware though that it can do just the same one liner type stuff, which is the attraction to awk. I can store the code in a sort of project document to be copied and pasted to the command line, a tool box I suppose, with specific tools for a specific data set that doesn't change.

Now if perl can do pythagoras on 6 million records against 3,000 records (umpteen billion calcs) and select the nearest from the 3,000 and add that to each of the 6 million, in a reasonable time, where we have (elsewhere in here) agreed pythagoras-with-awk will take too long ( however long that was, I forget); and do it in a sort of one liner (or just a few) style, you have my rapt attention.

Comparing 3,000 coordinates against each one of 6 million records - so I can escape learning SQL, actually it's not the SQL I mind as I quite like it, it's the "credentials" for connecting …
0
I want to create a Perl script that reads a file based on file name input from the user, processes each line, detects the category in the 4th column, sums each amount in the 3rd column based on if the category in the 4th column is the same and prints a total for each categorical amount. I have made it up to this point (see code and attached .csv file below). Please help. Thanks.

____


#!/usr/bin/perl
use strict;
use warnings;

my $file = <STDIN> or die "Need to get CSV file on the command line\n";

my $sum = 0;
open(my $data, '<', $file) or die "Could not open '$file' $!\n";

while (my $line = <$data>) {
  chomp $line;
  my @fields = split "," , $line;
     # while the category field is the same {
         $sum += $fields[2];
    }
}
print "$sum\n";
0
i am searching a term across 900 adobe pdfs in a windows folder.

ideally, i would like the results to show me all files ordered by how many mentions of the word are in each file.

what solution should i pursue.
0
Need to add to my unsophisticated Perl script the ability to parse a "local_tran_id" returned from an Oracle Sql-query to use in another query to the database.

Need to parse each of the values in this example delimited by "."

                  example: 12.345.67843

Need to store each of (3) values separated by the dot in (3) separated variables of an array.  Appreciate the help. Thanks!
0
Hi, I have a sub-folder on my website,  /info/. In that directory, I have maybe 100 original articles which I can separate into 11 topics. I'm trying to create an article index, so that readers can find articles they're looking for,

I add new articles to the directory at least monthly. Due to my inherent laziness and the likelihood of forgetting, I'd rather not update an index of those articles every time I add a new one.

Is there a way I can automatically populate the index? Here's the sort of thing I'm using, the categories are the only thing populated correctly. http://www.magickitchen.com/info/article-index.html

Thanks!
0

Perl

25K

Solutions

11

Articles & Videos

10K

Contributors

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.