Walter,
I have not tested this but I believe your problem is the greedy
matching. It is matching from one { to the furthest } it can. I am
guessing that \w is matching those internal }{ and the $ which I don't
think it should but they might be ignored because they are generally
meta characters.
I actually use Mail::Sender and here is a sample of how.
my $sender = new Mail::Sender({
smtp => "skyline", # smtp mail sever
from => $from, # list of comma separated email addresses
});
$sender->MailFile({
to => $to, # list of comma separated email addres
See my comments bellow. I'm not sure it I helped or not but hopefully I
at least clarified ?.
Matt
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, December 10, 2008 13:39
Cc: Perl-Unix-Users@listserv.act
Perdeep,
I think this code should do what you are looking for:
# retool your data into something more usable, a hash of arrays
foreach $key (keys %Values) {
# split the values for the key
@values = split(/\s/, $Values{$key});
foreach $val (@values) {
# set this value in an ar
Let me clarify. I didn't mean "system calls" but shell calls.
Matt
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Matt Schneider
Sent: Thursday, February 08, 2007 1:06 PM
To: Ben Eagle; perl-unix-users@listserv.ActiveState.
Ben,
If you make any system calls in your script you might be running into
the same problem. Absolute paths will help there too.
Matt
From: Ben Eagle [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 08, 2007 12:36 PM
To: Matt Schneider; perl-unix-users
The path variable is probably different for the anonymous web user on
Solaris. Can you add make it work by adding a use lib statement that
tells the script where the module is installed?
Something like:
use lib '/usr/local/perl/lib/whatever';
Matt
From:
Terry,
Something like this should work. Note this is not tested. Here's a
little explanation too. The '.' matches any character as you know and
the '*' says any number of those any characters. The key is the '?'
after the '*' which makes the match "non-greedy". Normally the '*'
matches as
You could try something like this:
$data = '760434|c|061230';
($date) = $data =~ m/^.\|(\d+)/;
$date =~ s%(\d\d)(\d\d)(\d\d)%$2/$3/20$1%;
Matt
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
AITHA, BHEEMSEN (SBCSI)
Sent: Friday, January 05, 2007 11:57 AM
The only thing that I see right off is that faxstat might not reside in
a directory in the cron path. I have run into this before. You might
try giving an absolute path and see if that works.
Matt
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Toddy
Title: Counting words
Craig,
A fairly simple way to do this would be to open the file
and step though it tracking the first words like this:
open FH, "the_file.txt";
foreach $line () {
# non-greed pattern match to get the
first word on the line ($first_word) =
$line =~ /^(\S+?)\s
Perhaps others might
know better but to the best of my knowledge the fork command doesn't
work that way. The child and parent
are two completely separate processes that don't
share any resources. What you are looking for is something more
like threads where each thread can access shared
I changed your regular expression to this and it worked:
$value =~ /^[0-9]+$|^[0-9][0-9,]*[0-9]$/
Matt Schneider
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Friday, June 10, 2005 12:35 PM
To: perl-unix-users
Just a stab in the dark but I have not like the way modules have worked
before so I have gone into the installed module in /usr/lib/... and
changed it there. You might see if that is feasible for your problem or
there may be a way in the module already to set the output type.
Matt Schneider
Peter,
Single quotes means to interpret whatever is between them literally.
Therefore the $ that marks your variable is interpreted as only a dollar
sign and not the start of a variable name. '$folder_name' is the same
as saying "\$folder_name".
Matthew Schneider
System Admin / Programmer
SKLD I
I think you problem is in your if statement. See below.
Matthew Schneider
System Admin / Programmer
SKLD Information Services, LLC
303-820-0863
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Avadhani, Subramanya
Sent: Friday, December 03, 2004 4:37 AM
T
Lixin,
Perl's mkdir function does not do parent directory creation
like the shell command "mkdir -p somedir". I wrote a little function to
get around this.
# make a directory and it's parent if necessarysub
mkdirp { my $dir = shift; my $check;
# if something with this path al
In the shell I would run the following
command:
cat Meas.atl00.1040.0710
Meas.atl00.1040.0711
Meas.atl00.1040.0712
Meas.atl00.1040.0713
Meas.atl00.1040.0714
Meas.atl00.1040.0715
Meas.atl00.1040.0716
> bigfile.txt
Thanks,Matthew SchneiderSystem
Administrator / ProgrammerSKLD Informat
It's not pretty or elegant but it does get the job done:
$str = "abc.def.ghi.jkl.mno";
@parts = split /\./, $str;
for ($i=0; $i<$#parts; $i++) {
$new_str .= "$parts[$i]_"; }
$new_str .= ".$parts[-1]";
Matthew Schneider
System Administrator / Programmer
SKLD Information Services, LLC
303.820.0
Does anyone know how to increase the timeout time for a soap transport over HTTP
client session? I have looked around in all the soap modules and the HTTP modules too
and can't find it anywhere.
Matthew Schneider
System Administrator / Programmer
SKLD Information Services, LLC
303.820.0863
___
You could do something like this:
$check_return = system "runthis";
print "\'runthis\' exited with code \'$check_return\'\n" if ($check_return != 0);
Matthew Schneider
System Administrator / Programmer
SKLD Information Services, LLC
303.820.0863
-Original Message-
From: [EMAIL PROTECTED
print "Hello there.\n";
Matt Schneider
Programmer/System Administrator
SKLD Information Services
303.820.0863
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Gomez, Juan
Sent: Monday, April 19, 2004 12:10 PM
To: [EMAIL PROTECTED]
Subject: [Perl-
I think what you are looking for is:
$string =~ s/\|+/\|/g;
Matthew Schneider
System Administrator / Programmer
SKLD Information Services, LLC
303.820.0863
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Johnno
Sent: Monday, April 05, 2004 8:46 AM
To: [EMA
I was able to get this to work by just doing normal regular expression matching.
$stringFromFirstFile = "Test: trying to capture this part of the string";
$stringFromSecondFile = "^Test: (.*)";
($capture) = $stringFromFirstFile =~ /$stringFromSecondFile/;
print "$capture\n";
Matthew Schneider
Here is a sample line from my crontab where I do that exact thing
13 07-19 * * 0-6 . /home/grunt/.bash_profile; get_map_list.pl
Matthew Schneider
System Administrator / Programmer
SKLD Information Services, LLC
303.820.0863
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTE
You could do something like this:
# get a list of log files somehow
@logs = `ls *.log`;
# remove the new lines from the end of each element due to
# the way I generated the list
chomp @logs;
# make sure the list is in order
@logs = sort @logs;
# remove all but the last 10 archive log files and the
Title: perl equivalent to "cut"
I'd do something like this
$string = "BLAH=VALUE ONE";
($string) = $string =~ m/=(.+)$/;
print "$string\n";
or
$string = "BLAH=VALUE ONE";
(@string) = split m/=/, $string;
print "@string[1]\n";
Matthew Schneider System Administrator / Programmer SKLD Inform
at it will also remove anything like #, @,
^, *, etc. that might be in the string. You could add those to the regular
expression of course but I didn't want to go to the effort of adding every
special character on the keyboard.
$string =~ /[^\w\s\d]//g
Matt Schneider Programmer/Syste
variables in the two loops so just name the inner
file handle LECTOR1 and that should fix it.
Matt Schneider
Programmer/System Administrator
SKLD Information Services, LLC
-Original Message-
From: Ing. Ricardo Cumberbatch L. (PANNet - URC)
[mailto:[EMAIL PROTECTED]
Sent: Tuesday
it should be when alphas are present. Other than that I'm not sure what
might be the problem.
Matt Schneider
Programmer/System Administrator
SKLD Information Services, LLC
-Original Message-
From: Ing. Ricardo Cumberbatch L. (PANNet - URC)
[mailto:[EMAIL PROTECTED]]
Sent: Tuesd
"invisible" characters that make up the DOS new line and then
write it to a new file with a "\n" on the end.
Matt Schneider Programmer/System Administrator SKLD Information
Services, LLC
-Original Message-From: Martin Vernooij
[mailto:[EMAIL PROTECTED]]Sent: Tuesday,
x27;t automatically disconnect you. However,
your Telnet server might have a low timeout and in that case you might want to
periodically in that 3 minutes do a listing or something to keep the connection
active.
Matt Schneider Programmer/System Administrator SKLD Information
Services, LLC
-Ori
familiar with
because it has so many commands.
Matt Schneider
Programmer/System Administrator
SKLD Information Services, LLC
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 1:44 PM
To: [EMAIL PROTECTED]
Subject: [Perl-unix-users
After you read it in from a file do you chomp (@list_names)? If you don't
then there is a "\n" on the end that the hash function will see and say that
there is no data associated with that key. Perl Windows may automatically
ignore this I don't know.
Matt Schneide
I would try
$string2 = $string1;
$string2 =~ s%[-\.]%/%;
Matt Schneider
Programmer/System Administrator
SKLD Information Services, LLC
-Original Message-
From: Jon Shorie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 8:27 AM
To: [EMAIL PROTECTED]
Subject: [Perl-unix
could use it to perform any operation that can be done in a
Telnet session. The same goes for the SSH module only it has
security.
Matt Schneider Programmer/System Administrator SKLD Information
Services, LLC
-Original Message-From: Mundell, R. (Ronald)
[mailto:[EMAIL PROTECTED]
Title: Remote executing a script using perl
Ronald,
I
don't now your security requirements but you could try either the Telnet or SSH
module.
Matt Schneider Programmer/System Administrator SKLD Information
Services, LLC
-Original Message-From: Mundell, R. (Ronald)
[m
s 128 bit encryption so that
whoever is sniffing your data will not be able to get anything out of it
unless they have a 18-wheeler full of supercomputers to work on it. If you
are just going across your internal LAN you shouldn't have any problem
using Telnet unless you have internal s
much more work than it is worth with quicker
solutions out there. Although once written it might be the most efficient.
Matt Schneider
Programmer/System Administrator
SKLD Information Services, LLC
-Original Message-
From: Poon, Kelvin (Infomart) [mailto:[EMAIL PROTECTED]]
Sent: Mon
overhead.
Matt Schneider
Programmer/System Administrator
SKLD Information Services, LLC
-Original Message-
From: Poon, Kelvin (Infomart) [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 20, 2003 1:35 PM
To: '[EMAIL PROTECTED]'
Subject: [Perl-unix-users] Perl and UNix
Hi al
plit(/:/, $PATH);
or modify it any way you
like:$PATH .= ":.";
To remove a tied environment variable from the
environment, make it the undefined value:undef $PATH;
Note that the corresponding operation performed directly
against %ENV is not undef,
but delete:delete $ENV{PATH};
Ma
I would run this from the command line in that directory:
perl -e 'foreach $oldfile (<*>) { $newfile = "\L$oldfile"; rename $oldfile,
$newfile; }'
the \L in the quotes forces everything after it in the quotes to be
lowercase.
Matt Schneider
Programmer/System Admin
Terry,
Try this:
($mytempvar) = $linetoprobe =~ m/(.)...$/;
Putting $mytempvar in the () assigns it the character in the () in the
regular expression match where a "." will match any character.
Matt Schneider
Programmer/System Administrator
SKLD Information Services, LLC
(
43 matches
Mail list logo