Re: Is there a one-liner for this?

From: Gerald W. Lester (Gerald.Lester_at_cox.net)
Date: 05/31/04


Date: Sun, 30 May 2004 17:20:31 -0500

Phil Powell wrote:
> [CODE]
> set lob [lindex $cgiDisplayPathList 0]
> regsub {^/} $lob {} lob
> set cgiDisplayPathList [lreplace $cgiDisplayPathList 0 0 $lob]
> [/CODE]
>
> The simple thing I have to do is lob off the '/' from the very first
> element in a list, and I'm hoping for a simple one-liner for this, any
> ideas?
>
> Thanx
> Phil

With Tcl 8.4.5:

The following is all one line (it will likely be wrapped when you see it]:

lset cgiDisplayPathList 0 [regsub {^/} [lindex $cgiDisplayPathList 0] {}
lob; set lob]

-- 
+--------------------------------+---------------------------------------+
| Gerald W. Lester               | "The man who fights for his ideals is |
| Gerald.Lester@cox.net          |  the man who is alive." -- Cervantes  |
+--------------------------------+---------------------------------------+