FW: Replace last # with \n

2002-07-23 Thread Busse, Rich
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

Replace last # with \n

2002-07-23 Thread Busse, Rich
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) =

RE: If...

2002-05-15 Thread Busse, Rich
# 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"; } #

FW: Parsing a line - part 2

2002-04-24 Thread Busse, Rich
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+)=(

Parsing a line

2002-04-23 Thread Busse, Rich
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) ;

RE: Reg Exp help

2002-02-27 Thread Busse, Rich
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

Reg Exp help

2002-02-26 Thread Busse, Rich
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 =

Data conversion

2002-02-08 Thread Busse, Rich
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

Squeezing a list

2002-01-03 Thread Busse, Rich
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",

FW: C vs. Perl

2002-01-02 Thread Busse, Rich
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

FW: Running application

2001-10-22 Thread Busse, Rich
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

FW: system calls

2001-09-24 Thread Busse, Rich
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

Win NT 'diff'

2001-08-29 Thread Busse, Rich
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

RE: A little off topic - VB & Perl

2001-08-09 Thread Busse, Rich
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.

C & Perl for loops

2001-07-13 Thread Busse, Rich
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