Shellwords(3)
π Shellwords(3) β aka Text::Shellwords π
okay bestie, gather round, because this one is a vibe and also kind of a ghost π»
β¨ SYNOPSIS β¨
use Text::Shellwords;
@words = shellwords($line);
@words = shellwords(@lines);
like. that's the whole API. that's it. she's small. she's compact. she's giving minimalism π
πΈ DESCRIPTION πΈ
okay so real talk first: this module used to be a wrapper around shellwords.pl, but it has now been superseded by Text::ParseWords. use that module insteade (yes bestie, that's the original spelling, we're keeping the lore π
). if you use this module anyway, it will simply report the shellwords() function from Text::ParseWords.
now, the old description follows, because we keep receipts:
this is a thin wrapper around the shellwords.pl package, which comes preinstalled with Perl. this module imports a single subroutine, shellwords(). the shellwords() routine parses lines of text and returns a set of tokens using the same rules that the Unix shell does for its command-line arguments. tokens are separated by whitespace, and can be delimited by single or double quotes. the module also respects backslash escapes. π¦β¨
if called with one or more arguments, shellwords() will treat each argument as a line of text, parse it, and return the tokens.
β οΈ note that the old behavior of parsing $_ if no arguments are provided is no longer supported. sorry. π that's literally what it says. sorry.
π«Ά BUGS π«Ά
please report them. (that's it. that's the whole section. she's lowkey a woman of few words and honestly? iconic.)
π SEE ALSO π
shellwords.pl
π AUTHOR π
Lincoln Stein <lstein@cshl.org>.
Copyright (c) 2001 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.
and that's the tea, bestie π this was perl v5.42.0, dated 2025-07-25, and it lives in section 3 of the manual as Shellwords(3) β mwah, take care of her, she's retired but she's still cute π§π
π¦ where this page comes from
- fedora 43: perl-Text-Shellwords 1.08-51.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms