On Apr 22, pat said: >I've just started with perl and have 2 questions:- >Ques 1) If someone would kindly show me the code to split the following into >the special variables $1 $2 $3 upto $9. I have spent the best part of today >on it and I can separate the 08:45:50 and separate the string if there were >','s in it - which I do not want. I would like to place 'Mar' in $1, 17 in >$2, 08:48:50 in $3 and so on. > >$line = "Mar 17 08:48:50 msasa pppd[6404]: Connect: ppp0 <--> /dev/ttyS1"
Well, there's no need to put them into $1, $2, etc. That can only be done with a regex, and there's no need to do $line =~ /(\S+)\s+(\S+)\s+.../; Why not just do: @parts = split ' ', $line; >Ques 2) Where in the linux documentation do I find an example? I have >RH7.1. If you have perl installed, you have perldoc installed. japhy% perldoc -f split [...] -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]