home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 5058 < prev    next >
Encoding:
Text File  |  1992-07-31  |  1.9 KB  |  58 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!s5!is1.is.morgan.com!is0.is.morgan.com!robt
  3. From: robt@is.morgan.com (Rob Torop)
  4. Subject: Re: @ARGV
  5. In-Reply-To: toro.MTS.ML.COM!scott%beethoven@uunet.uu.net's message of 31 Jul 92 00:39:11 GMT
  6. Message-ID: <ROBT.92Jul31121248@idt101.is.morgan.com>
  7. Sender: news@is.morgan.com
  8. Nntp-Posting-Host: idt101
  9. Organization: Morgan Stanley & Company
  10. References: <1992Jul31.003911.12553@uvaarpa.Virginia.EDU>
  11. Date: Fri, 31 Jul 1992 17:12:48 GMT
  12. Lines: 44
  13.  
  14. In article <1992Jul31.003911.12553@uvaarpa.Virginia.EDU> toro.MTS.ML.COM!scott%beethoven@uunet.uu.net (Scott Strool) writes:
  15.  
  16.    Path: is1.is.morgan.com!s5!uunet!dtix!darwin.sura.net!uvaarpa!mmdf
  17.    From: toro.MTS.ML.COM!scott%beethoven@uunet.uu.net (Scott Strool)
  18.    Newsgroups: comp.lang.perl
  19.    Date: 31 Jul 92 00:39:11 GMT
  20.    Sender: mmdf@uvaarpa.Virginia.EDU (Mail System)
  21.    Reply-To: Scott Strool <toro.MTS.ML.COM!scott%beethoven@uunet.uu.net>
  22.    Organization: The Internet
  23.    Lines: 13
  24.  
  25.    How can I get the individual characters from the command line variable.
  26.    for instance if the user entered 'xbr'. I want to know that the first char
  27.    is 'x', second is 'b' and third is 'r'.
  28.  
  29.    thanks,
  30.    srs
  31.    Scott Strool
  32.    Consultant
  33.    Merrill Lynch & Co Inc.
  34.    Tel: (212) 449-1456
  35.    Fax: (212) 449-1465
  36.    scott@ml.com
  37.    uunet!toro!scott
  38.  
  39. This should do the trick:
  40.  
  41. @chars = split(//, $ARGV[0]);
  42.  
  43. The individual characters will then be $chars[0], etc...
  44.  
  45. -- Rob Torop
  46.  
  47. +---------------------------------------------------------------------+
  48. | The views expressed here are neither mine nor those of my employer. |
  49. +---------------------------------------------------------------------+
  50.  
  51.  
  52. --
  53. -- Rob Torop
  54.  
  55. +---------------------------------------------------------------------+
  56. | The views expressed here are neither mine nor those of my employer. |
  57. +---------------------------------------------------------------------+
  58.