Article View: pl.comp.lang.perl
Article #39820Re: Wyciagniecie danego wyrazu zmiennej
From: Szymon Sokół
Date: Thu, 21 Oct 2004 20:45
Date: Thu, 21 Oct 2004 20:45
27 lines
2126 bytes
2126 bytes
Twelve Hungry Mammoths <someone@microsoft.com> wrote:
: chodzi o to, zeby podzielic po spacjach i wziac drugi element?
: @wyrazy = split / /, $zm;
: $drugi = $wyrazy [1];
A jeszcze lepiej,
@wyrazy = split ' ', $zm;
Za perldoc -f split:
As a special case, specifying a PATTERN of space ('
') will split on white space just as "split" with no
arguments does. Thus, "split(' ')" can be used to
emulate awk's default behavior, whereas "split(/ /)"
will give you as many null initial fields as there
are leading spaces. A "split" on "/\s+/" is like a
"split(' ')" except that any leading whitespace
produces a null first field.
W końcu, nie było powiedziane, że wyrazy są oddzielone *pojedynczymi*
spacjami, prawda?
--
Szymon Sokół (SS316-RIPE) -- Network Manager B
Computer Center, AGH - University of Science and Technology, Cracow, Poland O
http://home.agh.edu.pl/szymon/ PGP key id: RSA: 0x2ABE016B, DSS: 0xF9289982 F
Free speech includes the right not to listen, if not interested -- Heinlein H
Technical Details
Message-ID:
<cl975m$b75$1@galaxy.uci.agh.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!not-for-mailReferences:
<20041021213941.02cbbd79@slwkk_desk> <cl951v$nn1$1@news.dialog.net.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.onet.pl!agh.edu.pl!news.agh.edu.pl!not-for-mail
From: Szymon Sokół
<szymon@bastard.operator.from.hell.pl>
Newsgroups: pl.comp.lang.perl
Subject: Re: Wyciagniecie danego wyrazu zmiennej
Date: Thu, 21 Oct 2004 20:45:42 +0000 (UTC)
Organization: University of Mining & Metallurgy
Lines: 27
Sender: Szymon Sokol <szymon@galaxy.uci.agh.edu.pl>
Message-ID: <cl975m$b75$1@galaxy.uci.agh.edu.pl>
References: <20041021213941.02cbbd79@slwkk_desk> <cl951v$nn1$1@news.dialog.net.pl>
NNTP-Posting-Host: galaxy.uci.agh.edu.pl
Mime-Version: 1.0
X-Trace: galaxy.uci.agh.edu.pl 1098391542 11493 149.156.96.9 (21 Oct 2004 20:45:42 GMT)
X-Complaints-To: usenet@uci.agh.edu.pl
NNTP-Posting-Date: Thu, 21 Oct 2004 20:45:42 +0000 (UTC)
User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (SunOS/5.8 (sun4u))
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit