I need a non-perl (bash) way to strip the path from a list of "find" results. Below is the perl version which I could use, if I could figure out how to call the script with a variable (like in sh, $1 is the variable passed in ./script variable)
$file = "/path/to/file.txt";
# How do I... (2 Replies)
Hi All,
I am calling a perl program in my shell script as follows.
MY_IN_FILE=ABC.dat
MY_OUT_FILE=XYZ.dat
MY_VARIABLE="SomeValue"
perl mycode.pl $MY_IN_FILE > $MY_OUT_FILE
Question:-
Now I want to pass value of $MY_VARIABLE from script to perl... How do I do that? Can someone... (5 Replies)
Hi All,
I am learning PERL for one of the projects, and in one of these scripts, I read a flat text file and print in the terminal.
The problem is, the text file has a date field. The format is yyyymmdd. I need to display this as dd-mon-yyyy.
Any ideas to do this? Thanks a lot for the... (9 Replies)
Hi all,
i had a code where in user will enter a date in yyyymmdd format.. i didnt use any validation for the date and now the problem is if a user enters date instead of month after year it is proceeding with the code..
like if the date is 20120426 and if the user enters 20122604 it... (4 Replies)
I have an Excel 2007 excel sheet on windows machine and using
Spreadsheet::XLSX I had written a script to read the excel sheet and was successful.
My requirement is I need to generate another excel sheet from the old excel 2007 sheet on unix machine.
Now is it possible to read the excel... (2 Replies)
my $sysdate = strftime('%Y-%m-%d', localtime );
biDeriveByDate('Table_Str',$sysdate,\@lIndx,\@lResVals)
In a perl script, when I'm trying to pass $sysdate to some external function it's not working since $sysdate is passed as a string mentioned above but my function is expecting a date value... (1 Reply)
hello,
i have a lot of C old code I'm updating to C11 with tgmath.h for generic math. the old code has very specific types, real and complex, like cabsl, csinhl, etc
usually for simple bulk replacements i would do something simple like this
perl -pi -e 's/cosl/cos/g' *.c
the reference... (0 Replies)
Hi All,
I have line
,A,FDRM0002,12/21/2017,,0.961751583,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
it contains date in mm/dd/yyyy format i want to change this to yyyymmdd format using perl.
Use code tags, thanks. (8 Replies)
The below perl script parses a variety of formats. If I use the numeric text file as input the script works correctly. However using the alpha text file as input there is a black output file. The portion in bold splits the field to parse f or NC_000023.10:g.153297761C>A into a variable $common but... (3 Replies)
Perl::Critic::Policy::Modules::ProhibitConditionalUseStaUsernContributed Perl Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements(3pm)NAME
Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements - Avoid putting conditional logic around compile-time includes.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Modules included via "use" are loaded at compile-time. Placing conditional logic around the "use" statement has no effect on whether the
module will be loaded. Doing so can also serve to confuse the reader as to the author's original intent.
If you need to conditionally load a module you should be using "require" instead.
This policy will catch the following forms of conditional "use" statements:
# if-elsif-else
if ($a == 1) { use Module; }
if ($a == 1) { } elsif ($a == 2) { use Module; }
if ($a == 1) { } else { use Module; }
# for/foreach
for (1..$a) { use Module; }
foreach (@a) { use Module; }
# while
while ($a == 1) { use Module; }
# unless
unless ($a == 1) { use Module; }
# until
until ($a == 1) { use Module; }
# do-condition
do { use Module; } if $a == 1;
do { use Module; } while $a == 1;
do { use Module; } unless $a == 1;
do { use Module; } until $a == 1;
# operator-do
$a == 1 || do { use Module; };
$a == 1 && do { use Module; };
$a == 1 or do { use Module; };
$a == 1 and do { use Module; };
# non-string eval
eval { use Module; };
Including a module via "use" in bare blocks, standalone do blocks, or string evals is allowed.
# bare block
{ use Module; }
# do
do { use Module; }
# string eval
eval "use Module";
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Peter Guzis <pguzis@cpan.org>
COPYRIGHT
Copyright (c) 2010-2011 Peter Guzis. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.14.22012-06-07Perl::Critic::Policy::Modules::ProhibitConditionalUseStatements(3pm)