Section: User Contributed Perl Documentation (3)
use Text::Shellwords; @words = shellwords($line); @words = shellwords(@lines);
This used to be a wrapper around shellwords.pl, but has now beensuperseded by Text::ParseWords. Use that module insteade. If youuse this module, it will simply report the shellwords()
The old description follows:
This is a thin wrapper around the shellwords.pl package, which comespreinstalled with Perl. This module imports a single subroutine,shellwords(). The shellwords() routine parses lines of text andreturns a set of tokens using the same rules that the Unix shell doesfor its command-line arguments. Tokens are separated by whitespace,and can be delimited by single or double quotes. The module alsorespects backslash escapes.
If called with one or more arguments, shellwords() will treat eachargument as a line of text, parse it, and return the tokens.
Note that the old behavior of parsing $_ if no arguments are providedis no longer supported. Sorry.
Please report them.
Lincoln Stein <lsteinAATTcshl.org>.
Copyright (c) 2001 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modifyit under the same terms as Perl itself. See DISCLAIMER.txt fordisclaimers of warranty.
- SEE ALSO
This document was created byman2html,using the manual pages.