From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2716 invoked from network); 28 Aug 2004 07:47:11 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Aug 2004 07:47:11 -0000 Received: (qmail 5959 invoked from network); 28 Aug 2004 07:47:04 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Aug 2004 07:47:04 -0000 Received: (qmail 25892 invoked by alias); 28 Aug 2004 07:46:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7942 Received: (qmail 25882 invoked from network); 28 Aug 2004 07:46:20 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 28 Aug 2004 07:46:20 -0000 Received: (qmail 3824 invoked from network); 28 Aug 2004 07:44:22 -0000 Received: from lyta.akte.de (217.160.134.217) by a.mx.sunsite.dk with SMTP; 28 Aug 2004 07:44:21 -0000 Received: (root@lyta.akte.de) by lyta.akte.de id ; Sat, 28 Aug 2004 09:44:09 +0200 KRecCount: 1 KInfo: virscan ok KInfo: NoRelay, NoSpam Received: from condor.int.spiegl.de (pD9E9390F.dip.t-dialin.net [217.233.57.15]) by lyta.akte.de via kasmail (2.9) id ; Sat, 28 Aug 2004 07:43:58 GMT Received: from condor.int.spiegl.de (spiegl@localhost [127.0.0.1]) by condor.int.spiegl.de (8.12.11.Beta0/8.12.11.Beta0/Debian-1) with ESMTP id i7S7htPG008782 for ; Sat, 28 Aug 2004 09:43:55 +0200 Received: (from spiegl@localhost) by condor.int.spiegl.de (8.12.11.Beta0/8.12.11.Beta0/Debian-1) id i7S7htuE008780 for zsh-users@sunsite.dk; Sat, 28 Aug 2004 09:43:55 +0200 X-Authentication-Warning: condor.int.spiegl.de: spiegl set sender to zsh.Andy@spiegl.de using -f Date: Sat, 28 Aug 2004 09:43:55 +0200 From: Andy Spiegl To: ZSH User List Subject: Re: how to force scalar to be an array? Message-ID: <20040828074355.GA4953@spiegl.de> Mail-Followup-To: ZSH User List References: <20040827154905.GA26846@spiegl.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-GPG-Keys: mail -s "send pgp" auto@spiegl.de X-Accepted-File-Formats: ASCII .rtf .ps .pdf - *NO* MS Office files please. X-why-you-shouldnt-use-MS-LookOut: http://www.jensbenecke.de/l-oe-en.php X-warum-man-MS-Outlook-vermeiden-sollte: http://www.jensbenecke.de/l-oe-de.php X-Message-Flag: LookOut! You are using an insecure mail reader which can be used to spread viruses. User-Agent: Mutt/1.5.5.1+cvs20040105i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: * X-Spam-Status: No, hits=1.6 required=6.0 tests=BAYES_44,RCVD_IN_NJABL, RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 1.6 > So your only safe bet is to actually assign the scalar to an array, and > then use subscripting on the array. But then how would I be able to split the words if there are more than one? Hm, I think I must be doing something wrong here. Shouldn't it be an absolutely easy and common task to split a line into its words and then pick the first one and the rest of them. In Perl I'd do for example: (just to illustrate what I want to do) $result=`some_proggie` @words = split (/\s/, $result); or maybe: $result =~ /(\S+)(.*)/; $first_word=$1; $rest_words=$2; -- o _ _ _ ------- __o __o /\_ _ \\o (_)\__/o (_) -o) ----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\ ---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When women are depressed they either eat or go shopping. Men invade another country. --- Elayne Boosler