Re: A simple question about the Perl line

2009-11-27 Thread Majian
Thanks all . On Sat, Nov 28, 2009 at 3:00 AM, Randal L. Schwartz wrote: > > "Majian" == Majian writes: > > Majian> Hi ,all: > Majian> I have a problem about this : > > Majian> cat test: > Majian> 12 > Majian> 23 > Majian> 34 > Majian> 45 > Majian> 56 > Majian> 67 > > Majian> I want to bec

Re: a simple question about the line

2009-11-27 Thread Chris Charley
- Original Message - From: "Dermot" Newsgroups: perl.beginners To: "John W. Krahn" Cc: "Perl Beginners" Sent: Friday, November 27, 2009 12:29 PM Subject: Re: a simple question about the line 2009/11/27 John W. Krahn : Hello, $ echo &quo

Re: A simple question about the Perl line

2009-11-27 Thread Randal L. Schwartz
> "Majian" == Majian writes: Majian> Hi ,all: Majian> I have a problem about this : Majian> cat test: Majian> 12 Majian> 23 Majian> 34 Majian> 45 Majian> 56 Majian> 67 Majian> I want to become like this : Majian> 1223 Majian> 3445 Majian> 5667 Majian> I thought it for a long time , but I

Re: a simple question about the line

2009-11-27 Thread Dermot
2009/11/27 John W. Krahn : > Hello, > > $ echo "12 > 23 > 34 > 45 > 56 > 67 > 78" | perl -lpe'$\=--$|?$,:$/' > 1223 > 3445 > 5667 > 78 For the benefit of this Luddite, please explain? Dp. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@

Re: a simple question about the line

2009-11-27 Thread John W. Krahn
Majian wrote: Hi, all : Hello, I have a problem about the lines of the file , like this : cat test 12 23 34 45 56 67 78 ... == I want to display like this : 1223 3445 5667 It means the next line is after the last line . How do it by the Perl ? $ echo "12 23 34 45 56 6

Re: A simple question about the Perl line

2009-11-27 Thread lan messerschmidt
On Fri, Nov 27, 2009 at 8:34 PM, Majian wrote: > Could  you explain  it ? > > What is the meaning of the $.? And Why use  the "%2"  operator? > $. means the line number, see perldoc perlvar and look for $. %2 means the modulus operator. # perl -le 'print $_%2 for 0..3' 0 1 0 1 HTH. -- To unsub

Re: A simple question about the Perl line

2009-11-27 Thread lan messerschmidt
On Fri, Nov 27, 2009 at 8:03 PM, Majian wrote: > Hi ,all: > > I have a problem about this : > > cat test: > 12 > 23 > 34 > 45 > 56 > 67 > ... > > I want to become like this : > 1223 > 3445 > 5667 > ... > # perl -e ' $m=<) { chomp if $.%2; print; }' 1223 3445 5667 -- To unsubscribe, e-m

Re: a simple question

2004-06-16 Thread WilliamGunther
In a message dated 6/16/2004 12:10:54 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: >Thanks in advance for your kind help. > >For the following string: > >" axyzb cxyzd " > >What is the command to extract the substrings with "xyz" in them? In this case, I'd like to >get two st

Re: a simple question

2004-06-16 Thread Bernard Kenik
This code should do it. my $List = " axyzb cxyzd "; my @Words = split(' ', $List); print "@Words\n"; my $Word; my @xyz; foreach $Word (@Words) { push @xyz, $Word if $Word =~ /.*xyz.*/; } print "@xyz"; "Kevin Zhang" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Tha

Re: a simple question

2004-06-16 Thread Jeff 'japhy' Pinyan
On Jun 16, Kevin Zhang said: >For the following string: > >" axyzb cxyzd " > >What is the command to extract the substrings with "xyz" in them? In this >case, I'd like to get two strings "axyzb" and "cxyzd". Well, you could do: my @matches = grep /xyz/, split ' ', $string; Let me

RE: A simple question

2002-05-20 Thread Shishir K. Singh
AM To: 'Stuart Clark'; 'Perl List' Subject: RE: A simple question > -Original Message- > From: Stuart Clark [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 17, 2002 11:08 PM > To: 'Perl List' > Subject: A simple question > > > Hi All

RE: A simple question

2002-05-20 Thread Bob Showalter
> -Original Message- > From: Stuart Clark [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 17, 2002 11:08 PM > To: 'Perl List' > Subject: A simple question > > > Hi All > Is there an easier way of picking out the number 16764 in this line > rather that using an array, split then $number[3]

Re: A simple question

2002-05-17 Thread John W. Krahn
Stuart Clark wrote: > > Hi All > Is there an easier way of picking out the number 16764 in this line > rather that using an array, split then $number[3] > > I just want to get 16764 into $recievedmail > > Is the answer something like this > > $recievedmail = ($data)[3]; > > $data = "Received

Re: a simple question

2002-02-26 Thread Michael Kelly
On 2/26/02 10:27 PM, jds <[EMAIL PROTECTED]> wrote: > #win2k system > > ... > @array=; > ... > > Q:when running,how to break the input,and not exit program? Hi jds, Your EOF char. On most systems, this is ^D, and on Windows I believe it is ^Z. Hope that helps, -- Michael -- To unsubscrib

Re: A simple question

2001-07-10 Thread Craig Moynes/Markham/IBM
From: Jie Meng <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 10, 2001 5:02 PM Subject: A simple question > > Dear all, > > I plan to write a simple remote connection script, and then "ls" the content > > of the current directory, input like > > telnet hostname > > username > >

Re: A simple question

2001-07-10 Thread M.W. Koskamp
- Original Message - From: Jie Meng <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 10, 2001 5:02 PM Subject: A simple question Dear all, I plan to write a simple remote connection script, and then "ls" the content of the current directory, input like telnet hostname u

Re: A simple question

2001-07-10 Thread Luke Bakken
Use rsh or ssh - system "rsh -l $username $hostname ls"; for the above to wrk without a password, your client machine's hostname must be in $username's .rhosts file. Better yet, use ssh with RSA or DSA authentication - then you won't be exposing your password in plaintext. There's also a Net::

Re: A simple question

2001-07-10 Thread Craig S Monroe
Jie, I am not an expert, but since participating in this wonderful list, it has been inferred that one should shy away from system commands when perl actually has modules that are designed for the desired goal. I would check out IO::Socket or Net::Telnet. Craig [EMAIL PROTECTED] Pager Numeric: 1