On Sat, Jan 13, 2024 at 12:41 PM Andrew Solomon wrote:
> > when is an array in perl declared with [] instead of ()?
>
> Using the [ ] delimiters you are creating a *reference* to an array.
> (Think of a reference as the memory address where the array is stored). So
>
> my $foo = [1,2,3];
>
> is e
On Tue, Oct 5, 2021 at 3:35 PM reader wrote:
> Whenever I don't do scripting for longish periods, next time I start
> writing a perl script, an awful lot of useful info has flew right out
> of my pea brain.
>
> I was pretty sure I have written perl scripts that wrote to log files
> with out prob
In addition to the comments made by David, it appears the line:
open FASEQ, "<", $files or die "can not read open $!";
is not needed. The file handle FASEQ is never used in an input operation.
You want to use the file name as noted by David.
Ken
On Thu, Oct 10, 2019 at 4:06 AM 刘东 wrote:
> he
On Fri, Feb 3, 2017 at 7:18 PM, SSC_perl wrote:
> I have the following sub that creates a log file using
> Data::Dumper. It also lists the name of each of the variables that it’s
> fed. It works great except for one problem - every line is appended with “
> = undef;” (minus the quotes).
Hi Jovan,
On Sat, Nov 5, 2016 at 1:14 PM, Jovan Trujillo
wrote:
> Hi All,
> I thought I could use a simple regex to match files like this:
>
> 1207003PE_GM_09TNPLM2
>
> and ignore files with extensions like this:
>
> 1207003PE_GM_09TNPLM2.csv
>
> I originally though m/[A-Za-z0-9\_]+/ wou
On Wed, Apr 13, 2016 at 9:29 PM, Kenneth Wolcott
wrote:
> Hi;
>
> I have the following output from Data::Dumper and I want to extract
> the first string that the "Id" name points to.
>
> $VAR1 = [
> bless( {
>'Id' => [
>'01tC003udXAI
On Wed, Mar 2, 2016 at 5:40 AM, Arghya Das wrote:
> #copies 1 file to another
>
> use warnings;
>
> use File::Copy;
>
> copy("FILE1.txt","new_file.txt");
>
>
>
> This script works if FILE1.txt is in current directory of windows but when
> i try to give a full path to a file like : "C:\Folder1\FIL
On Mon, Dec 7, 2015 at 9:35 PM, Kenneth Wolcott
wrote:
> On Mon, Dec 7, 2015 at 6:31 PM, Kenneth Wolcott
> wrote:
> > Hi;
> >
> > I've inherited a lot of Perl [mostly ActiveState] (and bash) scripts
> > were the former writers and maintainers did not use "use strict" and
> > "use warnings" and
On Thu, Jul 9, 2015 at 6:01 AM, Nagy Tamas (TVI-GmbH) <
tamas.n...@tvi-gmbh.de> wrote:
> Hi,
>
>
>
> The following code doesn’t recognize dirs. As I list the dir into the XML,
> it shows dirs as ordinary files.
>
>
>
> Like the –d would not work. If I add an extra branch to recognize files
> with
> cat tst:
>
> #!/usr/local/bin/perl
>
> use strict;
> use warnings;
>
> my $cmd = 'ls /';
>
> open my $ch, '-|', "$cmd" or die "Can't open $cmd: $!";
>
> while ($ch) {
> print;
> }
I believe you meant:
while (<$ch>)
HTH, Ken
On Sun, Nov 2, 2014 at 5:22 PM, Harry Putnam wrote:
> Intermitten
On Mon, Oct 6, 2014 at 11:11 AM, Phil wrote:
> Hello There,
>
> I have a text file that is built up as follows:
>
> Naam;ISIN;Symbol;Market;Trading Currency
> IDI;FR051393;IDIP;Euronext Paris;EUR
> BETER BED;NL339703;BBED;Euronext Amsterdam;EUR
> ...
> GENTICEL;FR0011790542;GTCL;Euronext
On Wed, Jul 30, 2014 at 2:27 PM, Martin G. McCormick <
mar...@server1.shellworld.net> wrote:
> There are two arrays or lists. One is called
> @from_addresses and the other is @destinations. For the program
> to work, there must be at least one, possibly many strings in
> each of those arra
I think you want to use 'map' instead of grep.
HTH, Ken
On Mon, Mar 3, 2014 at 6:35 PM, shawn wilson wrote:
> So, when I do this:
> my $src = (grep {/.*(ARIN|APNIC).*(\n)?/; $1} @ret)[0];
> I get a full line and not just the capture:
> # ARIN WHOIS data and services are subject to the Terms o
As others have mentioned, you should profile the program to get an idea of
what code is taking up time. That said, here are a couple of comments:
When you have that many arguments, it is usually preferrable (may be a
little faster) to use the following (rather than shifts):
my ($self, $data, $sta
On Sun, Jan 27, 2013 at 11:30 AM, Mike Flannigan wrote:
>
> I have written some CGI applications that start
> with this code:
>
>
> BEGIN {
> my $homedir = ( getpwuid($>) )[7];
> my @user_include;
> foreach my $path (@INC) {
> if ( -d $homedir . '/perl' . $path ) {
>
On Sun, Dec 23, 2012 at 8:27 AM, punit jain wrote:
> Hi,
>
> I am doing grouping but seeing some weird behavior :-
>
> the strings in a file are like :-
> AccessModes =
> (18,Mail,POP,IMAP,PWD,WebMail,WebSite,Relay,Mobile,FTP,MAPI,TLS,LDAP,WebCAL);
>
> ...
> .
> multiple lines
>
> I am seeing
On Thu, Nov 8, 2012 at 7:42 AM, Marco van Kammen wrote:
> Yeah, so something like this:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my $previous_month;
> my $previous_month_num;
>
> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
>
> my @months = ( 'JAN', 'F
On Fri, Oct 26, 2012 at 6:27 AM, Praveen Kumar
wrote:
> Hi folks,
>
> Check out below code, is this as expected or kind of bug?
>
>
> use strict;
> use warnings;
> use CGI;
>
> my $product_id="484f2faee9334559a1a72b4cdc056818";
> print "Enter NT Login ID : ";
> chomp (my $user = );#pravee
On Wed, Aug 22, 2012 at 10:39 AM, jet speed wrote:
> Hi All,
>
> Please advice me on now to capture the data below in the format as below.
>
> i thought of using hash, but then the problem is each DisplayDevNum has
> multiple WWN. some has 4 elements, some has 2. Any other method ?
> Apprecaite y
On Sat, Jul 7, 2012 at 9:07 AM, Chris Stinemetz
wrote:
> Hello list,
>
> I have constructed an anonymous array with all the data I need.
> I am having some difficulty in accessing and printing out the data the way
> I want.
> For the sake of not cluttering this thread too much I have uploaded the
On Sun, Jul 1, 2012 at 9:12 AM, Chris Stinemetz
wrote:
> I have a two line pattern I would like to match and include 3 groupings.
>
> 59 REPT: EVDO: RNC 24 CP FAILURE SUMMARY SESSION RELEASE
> RAN AUTH FAILURE PPP, ERROR CODE 51001
>
> For final outcome I would like:
>
> $1 = 24
> $2 = CP F
On Mon, Jun 11, 2012 at 9:36 PM, Ken Slater wrote:
> On Mon, Jun 11, 2012 at 2:06 PM, GlenM wrote:
>> Hello Folks;
>>
>> I see an earlier post about sluggish code - I am not really sure what I am
>> doing, so I let me
On Mon, Jun 11, 2012 at 2:06 PM, GlenM wrote:
> Hello Folks;
>
> I see an earlier post about sluggish code - I am not really sure what I am
> doing, so I let me post my entire script here.
>
> ++
>
> #!/usr/bin/perl
>
> #use strict;
> use DBI;
> use
On Wed, Jun 6, 2012 at 10:27 AM, Matt wrote:
> Looking at some old code I wrote.
>
> my @listing;
> open(IN, list.txt) or die $!;
> while () {
> chomp;
> next if /^\s*$/;
> next if /^#/;
> push(@listing, $_);
> }
> close IN;
>
> I want to trim any new lines off end of data. chomp does
On Thu, May 24, 2012 at 11:41 AM, Ken Furff wrote:
> I am using the spreadsheet::xlsx module in a script im writing. I need to
> extract about 4 columns out of about 60. I need those specific columns for
> comparison and updating. I assume that I'll load the data into an array or an
> array of
On Tue, Apr 17, 2012 at 9:43 AM, Gary Stainburn
wrote:
> On Tuesday 17 April 2012 13:30:59 Manfred Lotz wrote:
>>
>> One example is this:
>>
>> #! /usr/bin/perl
>>
>> use strict;
>> use warnings;
>>
>> mysub;
>>
>> sub mysub {
>> print "Hi there\n";
>> }
>>
>> If you run this you get an error:
>
> -Original Message-
> From: Eko Budiharto [mailto:eko.budiha...@gmail.com]
> Sent: Friday, March 30, 2012 6:33 AM
> To: beginners@perl.org
> Subject: [question] array
>
> hi list,
> I would like to ask about 2 dimensional array
>
> my code:
> my $ref = $sth->fetchall_arrayref();
> foreac
> -Original Message-
> From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
> Sent: Wednesday, March 07, 2012 8:57 PM
> To: John W. Krahn; beginners@perl.org
> Subject: Re: problem with nested regex matchs
>
> >>
> >>>
> >>> open(MYINPUTFILE ,"/net/fallsroot/export/d100/m4/input_file");
On Sat, Mar 3, 2012 at 9:08 AM, lina wrote:
> $ perl extract.pl try.tex
> Bareword "filename" not allowed while "strict subs" in use at extract.pl line
> 8.
> Execution of extract.pl aborted due to compilation errors.
>
>
> #!/usr/bin/env perl
>
> use strict;
> use warnings;
>
> my $filename = $A
> -Original Message-
> From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
> Sent: Monday, February 20, 2012 3:51 PM
> To: beginners@perl.org
> Subject: Re: search and replace with an array
>
> Looks like I was able to figure it out with the below:
>
> But how do I remove all the blan
On Mon, Feb 13, 2012 at 11:09 AM, venkates wrote:
> Hi All,
>
> foreach my $ncbi_tax_id ( keys %{$new_proteins}) {
> my %kegg_map = ();
> my $up_tax_map = read_map (
> "$up_maps_dir/$taxon_labels{$ncbi_tax_id}.map");
> foreach my $gene_id ( keys %{$new_proteins->{$
On Mon, Feb 6, 2012 at 6:59 AM, Harry Putnam wrote:
> I've been looking around, googling for a way to extract exif info from
> images. There are many tools out there. But I wanted to fiddle with
> the information in very specific ways.
>
> I hit on the perl module: Image-ExifTool (Phil Harvey) on
> -Original Message-
> From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
> Sent: Wednesday, December 21, 2011 11:18 AM
> To: Binish A.R
> Cc: John W. Krahn; Perl Beginners
> Subject: Re: parsing data
>
> I'm trying to implement the advice that Binish, and John gave.
>
> I am getting
> -Original Message-
> From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
> Sent: Tuesday, December 20, 2011 9:22 AM
> To: Saravanan Murugaiah
> Cc: beginners@perl.org
> Subject: Re: Help in search concept
>
> >
> > I am a learner in Perl and this is my first post in this group. I
> n
> To: Perl Beginners
> Cc: Ken Slater; Chris Stinemetz
> Subject: Re: split function
>
> On 15/12/2011 16:09, Ken Slater wrote:
> >
> > I have not been following this too closely, but I don't understand
> the
> > algorithm used to get the above ou
> -Original Message-
> From: Ken Slater [mailto:kl...@psu.edu]
> Sent: Thursday, December 15, 2011 11:09 AM
> To: 'Chris Stinemetz'; 'John W. Krahn'
> Cc: 'Perl Beginners'
> Subject: RE: split function
>
> > -Original M
> -Original Message-
> From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
> Sent: Thursday, December 15, 2011 10:47 AM
> To: John W. Krahn
> Cc: Perl Beginners
> Subject: Re: split function
>
> I'm getting a bit closer. There a couple roadblocks I am up against.
>
> I am able to spli
> -Original Message-
> From: Chris Stinemetz [mailto:chrisstinem...@gmail.com]
> Sent: Wednesday, December 07, 2011 4:11 PM
> To: beginners@perl.org
> Subject: uninitialized value
>
> after converting an older Perl script to using strict pragma I am
> getting the follow error:
>
> I can'
> From: james varghese [mailto:james2...@gmail.com]
> Sent: Tuesday, October 11, 2011 8:31 AM
> To: beginners@perl.org
> Subject: perl script help
>
> hi,
> I am new to perl programming.I am trying with the following script and
> need help for it.
>
> I consolidated 10 excel files(in .txt format)
> From: Nathalie Conte [mailto:n...@sanger.ac.uk]
> Sent: Friday, September 30, 2011 9:38 AM
> To: beginners@perl.org
> Subject: parsing script removing some lines help please
>
>
>
> Hi,
> I am lost in my script, and would need to basic help please.
> I have got a file , separated by tabs, and
> -Original Message-
> From: Amish Rughoonundon [mailto:amishrughoonun...@gmail.com]
> Sent: Tuesday, September 27, 2011 4:44 PM
> To: beginners@perl.org
> Subject: system command question
>
> Hi,
> I am trying to run a make file from perl. For the make file to run,
> some environment var
> -Original Message-
> From: timothy adigun [mailto:2teezp...@gmail.com]
> Sent: Thursday, September 22, 2011 2:05 PM
> To: Maggs
> Cc: beginners@perl.org
> Subject: Re: Perl file handling
>
> Hi Maggs,
>
> I don't know what you really wants to achieve with your codes below:
>
>> (open
> -Original Message-
> From: anand.jaw...@emc.com [mailto:anand.jaw...@emc.com]
> Sent: Tuesday, August 23, 2011 5:57 AM
> To: beginners@perl.org
> Subject: Hash of Hashes - Error
>
> Hi All,
>
> I am working on the below code to traverse through a hash, but it
> throws an error which sta
> -Original Message-
> From: Steven Surgnier [mailto:ssurgn...@gmail.com]
> Sent: Tuesday, July 19, 2011 3:24 PM
> To: beginners@perl.org
> Subject: grep question
>
> Hi,
>
> I desire a concise conditional statement which simply checks if each
> entry
> in an array matches a given string.
> From: Irfan Sayed
> To: Perl Beginners
> Sent: Friday, June 24, 2011 3:13 PM
> Subject: rmdir
>
> hi,
> i need to delete some directories recursively which are present at some
> shared location
>
> i tried file::path perl module but the issue with that module is , it
> is not deleting the roo
> -Original Message-
> From: Parag Kalra [mailto:paragka...@gmail.com]
> Sent: Friday, June 17, 2011 9:39 AM
> To: Perl Beginners
> Subject: Timeout for user input
>
> Hi,
>
> I have a requirement where I want to wait for user to input the data.
>
> However if user doesn't input the data
Take a look at Win32::FileOp on CPAN
(http://search.cpan.org/~jenda/Win32-FileOp-0.14.1/FileOp.pm).
HTH, Ken
> -Original Message-
> From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com]
> Sent: Wednesday, June 15, 2011 2:50 AM
> To: Perl Beginners
> Subject: virtual drive
>
> Hi,
>
> is t
>From: Brian F. Yulga [mailto:byu...@langly.dyndns.org]
>On Wed, 2 Mar 2011, Matt wrote:
> > The easiest way in my opinion is to use the 'grep' function like this:
> >
> > my $searchstring="whatever";
> > open CFG, '<', $_file || die("could not open file: $_file!"); my
> > @data=; close CFG; if
>From: shawn wilson [mailto:ag4ve...@gmail.com]
>Sent: Saturday, February 12, 2011 5:56 PM
>To: beginners@perl.org
>Subject: DBD::mysql::st execute failed
>
>i'm getting this error:
>DBD::mysql::st execute failed: Column count doesn't match value count at
row
>1 at ./test-get.pl line 91, line 1.
>From: jm [mailto:jm5...@gmail.com]
>Sent: Friday, November 05, 2010 10:21 AM
>
>i appreciate the tips. unfortunately, adding modules to this server
>is not currently possible. does anyone have a more 'hands-on'
>solution?
Take a look at the Text::ParseWords module. I believe it should be
insta
-Original Message-
>From: Owen Chavez [mailto:owen.chavez314...@gmail.com]
>Sent: Thursday, September 30, 2010 2:41 AM
>To: beginners@perl.org
>Subject: Alternative to while ()
>
>Hey y'all,
>
>I suspect that I'm struggling with something that has a *really*
>straightforward alternative, b
Hi all,
I posted this a few days ago on comp.lang.perl.tk but have no responses.
So, I am hoping someone on this list may have some expertise. I will
post any answers on the comp.lang.perl.tk list (sorry for the cross post).
I'm trying to convert some Perl/Tk code to Perl/Tkx.
One problem I'm ha
Dermot wrote:
>Hi,
>
>I was reading Higher Order Perl[1] last night and, dishearteningly,
>got stuck on chapter one.
>
>Mark Dominus offers the following as a binary string conversion
>example of how recursion can work.
>
>
>use strict;
>use warnings;
>
>my $bstr = binary(37);
>print "$bstr\n";
53 matches
Mail list logo