TrojanWarBlade is right.
But I'd suggest the qq() function to avoid the backslashed quotes.
$cmd = qq("$dir/etc/run.bat" "$dir/build/edu/umd/simfinder/Eval");
HTH
...Here's a hash-of-hashes approach:
#!perl
use strict;
use warnings;
my $outerkey;
my @innerkeys;
my %HoH;
while (<DATA>) {
chomp;
/^\s*$/ && next;
/^-/ && next;
if (/^record\s+(.+)/) {
$outerkey = $1;
} elsif (/^\s+item\s+(.+):\s+(.*)/) {
# add $1 to...
One way is to use the Date::Calc module, e.g.
#!perl
use strict;
use warnings;
use Date::Calc qw(Decode_Date_EU);
my $file_ts = '01-JAN-2005';
my ($year, $month, $day) = Decode_Date_EU($file_ts);
my $out = sprintf '%02d/%02d/%04d', $month, $day, $year;
print $out, "\n";
How you expect to get...
It's not clear to me what you're trying to do. Are you trying to format a file's timestamp? (The name $FILE_TS suggests this.) You're still not showing enough of your code. Cut and paste it inside tags. If you don't know about tags, click on ProcessTGML below the box where you type your...
If your array elems are hash references
1. Dereference the element as a hash
2. Use the keys function to get a list of hash keys
3. Itererate over the keys and use the keys to look up the values.
This should do it.
for $i ( 0 .. $#cleanedData ) {
$aref = $cleanedData[$i];
$n =...
You could make the hash values code references. This seems to do what you want.
#!perl
use strict;
use warnings;
my %jason = (
red => sub{/^one/ && /two/ || /^three/ && /four/},
green => sub{/^five/ && /six/ || /^seven/ && /eight/},
);
while (<DATA>) {
my $found = 0;
for my...
Fields in a .csv file that contain commas are supposed to be surrounded in double quotes. Text::CSV_XS should handle this correctly. So I'm guessing your file is not a standard .csv file.
Can you post a representative sample of your file, surrounded in tags? If you don't know about tags...
Hmm, you mean something like this?
#!perl
use strict;
use warnings;
my $line = "1.2 blah 147 3.5 hey 9999 14.75";
my $pattern = qr/\d+\.\d+/;
my @found;
if (my @list = $line =~ /($pattern)/g) {
push(@found, [ @list ]);
}
for (@found) {
print join("\t", @$_), "\n";
}
This'll give it to you as ddmmyy.
my ($mday, $mon, $year) = (localtime(time))[3..5];
my $cdate = sprintf "%02d" x 3, $mday, $mon+1, $year%100;
my $filename = "taxout${cdate}.csv";
open (OUTTAX, ">$filename") or die "$!";
Here's something I wrote a while back that you may find useful. The heart of this is the parsefixed routine. You pass it a line of fixed-width data and a list with the starting positions and lengths of your data fields, and it returns the fields in an array.
This program assumes the first...
dmazzini, I don't see where you're using a variable as a file handle?
erdman, you can do it like this.
#!perl
use strict;
use warnings;
my $HANDLE;
open($HANDLE, ">erdman.txt") || die qq(Can't open "erdman.txt"!\n);
my @array = qw(apples oranges peaches pears grapes);
printReport($HANDLE...
I don't see a use statement in your code.
use Parse::Nessus::NBE qw(vars or subs from module);
You need this in order to use the module. Take a look at perldoc perlmod.
foreach my $f (@files){
next if ($name eq ".");
next if ($name eq "..");
What is $name here? Don't you mean $f?
sub addFiletoHash($f,$loc){
my $folder = shift;
my $path = $loc;
print "Folder is $folder and location is $loc\n";
chdir($f) or die "Unable to...
Use backticks or qx() if you want to capture the output.
Also, the string comparison operator is eq, not ==. The latter is for comparing numbers, not strings.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.