Doh! I forgot about using $! All I need is
s/#$/\n/ ;
Thanks to Tor & Tanton for getting my brain in gear...
> -Original Message-
> From: Busse, Rich
> Sent: Tuesday, 23 July, 2002 09:00
> To: 'Perl Beginners'
> Subject: Replace last # with
I have a string that looks like
Operator Overview#PGM#Report about all configured
operators#/opt/OV/bin/OpC/call_sqlplus.sh all_oper#
I want to replace the last "#" with a newline. I've come up with a few ideas
like
substr ($_, rindex ($_, "#"), 1) = "\n" ;
or
substr ($_, length ($_) - 1, 1) =
# Here's one way:
my $speed_cost_code = '';
if($avg_speed >= 0 && $avg_speed <= 5) { $speed_cost_code =
"A"; }
elsif ($avg_speed > 5 && $avg_speed <= 15) { $speed_cost_code =
"B"; }
elsif ($avg_speed > 15 && $avg_speed <= 25) { $speed_cost_code =
"C"; }
#
Thank you, John. This code does exactly what I want. Problem is, I only
understand about 30% of what's going on. I can figure out the use of the
hash, some of the pattern matching & $1/$2. But can someone elaborate on:
@keys{ qw/P ST U SL D/ } = \( $Proc, $Start, $Url, $Sleep, $Drive );
/(\S+)=(
I'm currently processing lines from an input file this way:
$_ = "P=IcwRcsm D=D:SL=20 ST=d:\icw\rcsm\StartSv.bat
U=http://uslv...";
@Token = split ;
foreach (@Token)
{
$Proc = $' if (/P=/i) ;
$Start = $' if (/ST=/i) ;
Thanks Daryl & 'Japhy' for your suggestions. I ended up using:
$Out = `$Cmd` ;
$Out =~ /^\|GRP\|\s*(.*)/m ;
The data I want ends up in $1.
-Original Message-----
From: Busse, Rich
Sent: Tuesday, 26 February, 2002 09:35
To: Perl Beginners
Subject: Reg E
I am capturing the output of a command in a string:
$Out = `$Cmd` ;
The output always looks like:
List of Templates and Template Groups assigned to 'somenode.us.dnb.com':
|GRP| SBS-DSM
=
I'm working with some log file entries that look like:
BDE Monitor End - Wed Jan 30 08:36:28 2002
I need to turn the time stamp part of it into:
2002 01 30 08 36 28
Are there modules available for this type of conversion? Would Date::Manip
be a good choice?
--
To unsubscribe, e-mail: [EMAIL
I have a list that contains some good data and some empty strings, like:
("Abiosdsk", "Afd", "", "", "", "Aha154x", "Aha174x", "aic78xx", "",
"Alerter", "", "", "", "Always", ...)
Is there a simple way to get rid of the empty strings and compress the list
down to:
("Abiosdsk", "Afd", "Aha154x",
This might have been beaten to death today, but I'd like to add my $0.02:
1. You Linux guru says "C would be faster than Perl"? Prove it. Are there
any specific benchmarks? Probably not. Remember, assembly language is faster
than C!
2. Just this morning I wrote a 3 line Perl fragment to run a pr
Watch the backslashes...
Try:
system("D:\\ultraedit\\uedit32.exe netlog.txt");
-Original Message-
From: phumes1 [mailto:[EMAIL PROTECTED]]
Sent: Monday, 22 October, 2001 08:02
To: [EMAIL PROTECTED]
Subject: Re: Running application
I have the following script which runs UltraEdit but
For Windows NT, try
system ("start $command");
For a load of options, enter "start /?" at the Windows NT command line.
-Original Message-
From: Najamuddin, Junaid [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 September, 2001 14:56
To: 'Sidharth Malhotra'; Jonathan Howe; [EMAIL PROTECTE
Windows NT 4.0 has 2 file compare utilities. COMP is a leftover from DOS,
but might be useful. FC is a little more flexible & has a couple more
features. Type COMP /? or FC /? from a Windows NT command line for details.
Microsoft Visual C++ 5.0 includes WINDIFF, which is does file compares with
a
You can use the Shell function, according to my ancient VB 3.0 manual:
Dim TaskId, Style
TaskId = Shell ("perlscript.bat", Style)
Simple? However:
* You should also code an On Error in case VB can't run/find perlscript.bat.
* 'Style' is a number 1-9 depending on how you want to run it.
In C, I can do something like this:
char ch ;
char sz [] = "?:\\dir\\myfile.ini" ;
for ( ch = 'c' ; ch <= 'z' ; ch++ )
{
sz[0] = ch ;
. . .
to spin thru all the possible drives on a Windows NT box. But Perl complains
about trying t
15 matches
Mail list logo