{
    "mode": "perldoc",
    "parameter": "id",
    "section": "-q",
    "url": "https://www.chedong.com/phpMan.php/perldoc/id/json",
    "generated": "2026-06-15T20:59:25Z",
    "sections": {
        "Found in /usr/share/perl/5.34/pod/perlfaq3.pod": {
            "content": "Is there an IDE or Windows Perl Editor?\nPerl programs are just plain text, so any editor will do.\n\nIf you're on Unix, you already have an IDE--Unix itself. The Unix\nphilosophy is the philosophy of several small tools that each do one\nthing and do it well. It's like a carpenter's toolbox.\n\nIf you want an IDE, check the following (in alphabetical order, not\norder of preference):\n\nEclipse\n<http://e-p-i-c.sf.net/>\n\nThe Eclipse Perl Integration Project integrates Perl\nediting/debugging with Eclipse.\n\nEnginsite\n<http://www.enginsite.com/>\n\nPerl Editor by EngInSite is a complete integrated development\nenvironment (IDE) for creating, testing, and debugging Perl scripts;\nthe tool runs on Windows 9x/NT/2000/XP or later.\n\nIntelliJ IDEA\n<https://plugins.jetbrains.com/plugin/7796>\n\nCamelcade plugin provides Perl5 support in IntelliJ IDEA and other\nJetBrains IDEs.\n\nKephra\n<http://kephra.sf.net>\n\nGUI editor written in Perl using wxWidgets and Scintilla with lots\nof smaller features. Aims for a UI based on Perl principles like\nTIMTOWTDI and \"easy things should be easy, hard things should be\npossible\".\n\nKomodo\n<http://www.ActiveState.com/Products/Komodo/>\n\nActiveState's cross-platform (as of October 2004, that's Windows,\nLinux, and Solaris), multi-language IDE has Perl support, including\na regular expression debugger and remote debugging.\n\nNotepad++\n<http://notepad-plus.sourceforge.net/>\n\nOpen Perl IDE\n<http://open-perl-ide.sourceforge.net/>\n\nOpen Perl IDE is an integrated development environment for writing\nand debugging Perl scripts with ActiveState's ActivePerl\ndistribution under Windows 95/98/NT/2000.\n\nOptiPerl\n<http://www.optiperl.com/>\n\nOptiPerl is a Windows IDE with simulated CGI environment, including\ndebugger and syntax-highlighting editor.\n\nPadre\n<http://padre.perlide.org/>\n\nPadre is cross-platform IDE for Perl written in Perl using wxWidgets\nto provide a native look and feel. It's open source under the\nArtistic License. It is one of the newer Perl IDEs.\n\nPerlBuilder\n<http://www.solutionsoft.com/perl.htm>\n\nPerlBuilder is an integrated development environment for Windows\nthat supports Perl development.\n\nvisiPerl+\n<http://helpconsulting.net/visiperl/index.html>\n\nFrom Help Consulting, for Windows.\n\nVisual Perl\n<http://www.activestate.com/Products/VisualPerl/>\n\nVisual Perl is a Visual Studio.NET plug-in from ActiveState.\n\nZeus\n<http://www.zeusedit.com/lookmain.html>\n\nZeus for Windows is another Win32 multi-language editor/IDE that\ncomes with support for Perl.\n\nFor editors: if you're on Unix you probably have vi or a vi clone\nalready, and possibly an emacs too, so you may not need to download\nanything. In any emacs the cperl-mode (M-x cperl-mode) gives you perhaps\nthe best available Perl editing mode in any editor.\n\nIf you are using Windows, you can use any editor that lets you work with\nplain text, such as NotePad or WordPad. Word processors, such as\nMicrosoft Word or WordPerfect, typically do not work since they insert\nall sorts of behind-the-scenes information, although some allow you to\nsave files as \"Text Only\". You can also download text editors designed\nspecifically for programming, such as Textpad (\n<http://www.textpad.com/> ) and UltraEdit ( <http://www.ultraedit.com/>\n), among others.\n\nIf you are using MacOS, the same concerns apply. MacPerl (for Classic\nenvironments) comes with a simple editor. Popular external editors are\nBBEdit ( <http://www.barebones.com/products/bbedit/> ) or Alpha (\n<http://www.his.com/~jguyer/Alpha/Alpha8.html> ). MacOS X users can use\nUnix editors as well.\n\nGNU Emacs\n<http://www.gnu.org/software/emacs/windows/ntemacs.html>\n\nMicroEMACS\n<http://www.microemacs.de/>\n\nXEmacs\n<http://www.xemacs.org/Download/index.html>\n\nJed <http://space.mit.edu/~davis/jed/>\n\nor a vi clone such as\n\nVim <http://www.vim.org/>\n\nVile\n<http://invisible-island.net/vile/vile.html>\n\nThe following are Win32 multilanguage editor/IDEs that support Perl:\n\nMultiEdit\n<http://www.MultiEdit.com/>\n\nSlickEdit\n<http://www.slickedit.com/>\n\nConTEXT\n<http://www.contexteditor.org/>\n\nThere is also a toyedit Text widget based editor written in Perl that is\ndistributed with the Tk module on CPAN. The ptkdb (\n<http://ptkdb.sourceforge.net/> ) is a Perl/Tk-based debugger that acts\nas a development environment of sorts. Perl Composer (\n<http://perlcomposer.sourceforge.net/> ) is an IDE for Perl/Tk GUI\ncreation.\n\nIn addition to an editor/IDE you might be interested in a more powerful\nshell environment for Win32. Your options include\n\nbash\nfrom the Cygwin package ( <http://cygwin.com/> )\n\nzsh <http://www.zsh.org/>\n\nCygwin is covered by the GNU General Public License (but that shouldn't\nmatter for Perl use). Cygwin contains (in addition to the shell) a\ncomprehensive set of standard Unix toolkit utilities.\n\nBBEdit and TextWrangler\nare text editors for OS X that have a Perl sensitivity mode (\n<http://www.barebones.com/> ).\n\nHow can I hide the source for my Perl program?\nDelete it. :-) Seriously, there are a number of (mostly unsatisfactory)\nsolutions with varying levels of \"security\".\n\nFirst of all, however, you *can't* take away read permission, because\nthe source code has to be readable in order to be compiled and\ninterpreted. (That doesn't mean that a CGI script's source is readable\nby people on the web, though--only by people with access to the\nfilesystem.) So you have to leave the permissions at the socially\nfriendly 0755 level.\n\nSome people regard this as a security problem. If your program does\ninsecure things and relies on people not knowing how to exploit those\ninsecurities, it is not secure. It is often possible for someone to\ndetermine the insecure things and exploit them without viewing the\nsource. Security through obscurity, the name for hiding your bugs\ninstead of fixing them, is little security indeed.\n\nYou can try using encryption via source filters (Starting from Perl 5.8\nthe Filter::Simple and Filter::Util::Call modules are included in the\nstandard distribution), but any decent programmer will be able to\ndecrypt it. You can try using the byte code compiler and interpreter\ndescribed later in perlfaq3, but the curious might still be able to\nde-compile it. You can try using the native-code compiler described\nlater, but crackers might be able to disassemble it. These pose varying\ndegrees of difficulty to people wanting to get at your code, but none\ncan definitively conceal it (true of every language, not just Perl).\n\nIt is very easy to recover the source of Perl programs. You simply feed\nthe program to the perl interpreter and use the modules in the B::\nhierarchy. The B::Deparse module should be able to defeat most attempts\nto hide source. Again, this is not unique to Perl.\n\nIf you're concerned about people profiting from your code, then the\nbottom line is that nothing but a restrictive license will give you\nlegal security. License your software and pepper it with threatening\nstatements like \"This is unpublished proprietary software of XYZ Corp.\nYour access to it does not give you permission to use it blah blah\nblah.\" We are not lawyers, of course, so you should see a lawyer if you\nwant to be sure your license's wording will stand up in court.\n",
            "subsections": []
        },
        "Found in /usr/share/perl/5.34/pod/perlfaq4.pod": {
            "content": "How do I validate input?\n(contributed by brian d foy)\n\nThere are many ways to ensure that values are what you expect or want to\naccept. Besides the specific examples that we cover in the perlfaq, you\ncan also look at the modules with \"Assert\" and \"Validate\" in their\nnames, along with other modules such as Regexp::Common.\n\nSome modules have validation for particular types of input, such as\nBusiness::ISBN, Business::CreditCard, Email::Valid, and\nData::Validate::IP.\n\nHow can I split a [character]-delimited string except when inside [character]?\nSeveral modules can handle this sort of parsing--Text::Balanced,\nText::CSV, Text::CSVXS, and Text::ParseWords, among others.\n\nTake the example case of trying to split a string that is\ncomma-separated into its different fields. You can't use \"split(/,/)\"\nbecause you shouldn't split if the comma is inside quotes. For example,\ntake a data line like this:\n\nSAR001,\"\",\"Cimetrix, Inc\",\"Bob Smith\",\"CAM\",N,8,1,0,7,\"Error, Core Dumped\"\n\nDue to the restriction of the quotes, this is a fairly complex problem.\nThankfully, we have Jeffrey Friedl, author of *Mastering Regular\nExpressions*, to handle these for us. He suggests (assuming your string\nis contained in $text):\n\nmy @new = ();\npush(@new, $+) while $text =~ m{\n\"([^\\\"\\\\]*(?:\\\\.[^\\\"\\\\]*)*)\",? # groups the phrase inside the quotes\n| ([^,]+),?\n| ,\n}gx;\npush(@new, undef) if substr($text,-1,1) eq ',';\n\nIf you want to represent quotation marks inside a\nquotation-mark-delimited field, escape them with backslashes (eg, \"like\n\\\"this\\\"\".\n\nAlternatively, the Text::ParseWords module (part of the standard Perl\ndistribution) lets you say:\n\nuse Text::ParseWords;\n@new = quotewords(\",\", 0, $text);\n\nFor parsing or generating CSV, though, using Text::CSV rather than\nimplementing it yourself is highly recommended; you'll save yourself odd\nbugs popping up later by just using code which has already been tried\nand tested in production for years.\n\nHow can I store a multidimensional array in a DBM file?\nEither stringify the structure yourself (no fun), or else get the MLDBM\n(which uses Data::Dumper) module from CPAN and layer it on top of either\nDBFile or GDBMFile. You might also try DBM::Deep, but it can be a bit\nslow.\n",
            "subsections": []
        },
        "Found in /usr/share/perl/5.34/pod/perlfaq6.pod": {
            "content": "I put a regular expression into $/ but it didn't work. What's wrong?\n$/ has to be a string. You can use these examples if you really need to\ndo this.\n\nIf you have File::Stream, this is easy.\n\nuse File::Stream;\n\nmy $stream = File::Stream->new(\n$filehandle,\nseparator => qr/\\s*,\\s*/,\n);\n\nprint \"$\\n\" while <$stream>;\n\nIf you don't have File::Stream, you have to do a little more work.\n\nYou can use the four-argument form of sysread to continually add to a\nbuffer. After you add to the buffer, you check if you have a complete\nline (using your regular expression).\n\nlocal $ = \"\";\nwhile( sysread FH, $, 8192, length ) {\nwhile( s/^((?s).*?)yourpattern// ) {\nmy $record = $1;\n# do stuff here.\n}\n}\n\nYou can do the same thing with foreach and a match using the c flag and\nthe \\G anchor, if you do not mind your entire file being in memory at\nthe end.\n\nlocal $ = \"\";\nwhile( sysread FH, $, 8192, length ) {\nforeach my $record ( m/\\G((?s).*?)yourpattern/gc ) {\n# do stuff here.\n}\nsubstr( $, 0, pos ) = \"\" if pos;\n}\n\nWhat's wrong with using grep in a void context?\nThe problem is that grep builds a return list, regardless of the\ncontext. This means you're making Perl go to the trouble of building a\nlist that you then just throw away. If the list is large, you waste both\ntime and space. If your intent is to iterate over the list, then use a\nfor loop for this purpose.\n\nIn perls older than 5.8.1, map suffers from this problem as well. But\nsince 5.8.1, this has been fixed, and map is context aware - in void\ncontext, no lists are constructed.\n",
            "subsections": []
        },
        "Found in /usr/share/perl/5.34/pod/perlfaq7.pod": {
            "content": "What is variable suicide and how can I prevent it?\nThis problem was fixed in perl 5.00405, so preventing it means\nupgrading your version of perl. ;)\n\nVariable suicide is when you (temporarily or permanently) lose the value\nof a variable. It is caused by scoping through my() and local()\ninteracting with either closures or aliased foreach() iterator variables\nand subroutine arguments. It used to be easy to inadvertently lose a\nvariable's value this way, but now it's much harder. Take this code:\n\nmy $f = 'foo';\nsub T {\nwhile ($i++ < 3) { my $f = $f; $f .= \"bar\"; print $f, \"\\n\" }\n}\n\nT;\nprint \"Finally $f\\n\";\n\nIf you are experiencing variable suicide, that \"my $f\" in the subroutine\ndoesn't pick up a fresh copy of the $f whose value is 'foo'. The output\nshows that inside the subroutine the value of $f leaks through when it\nshouldn't, as in this output:\n\nfoobar\nfoobarbar\nfoobarbarbar\nFinally foo\n\nThe $f that has \"bar\" added to it three times should be a new $f \"my $f\"\nshould create a new lexical variable each time through the loop. The\nexpected output is:\n\nfoobar\nfoobar\nfoobar\nFinally foo\n",
            "subsections": []
        },
        "Found in /usr/share/perl/5.34/pod/perlfaq8.pod": {
            "content": "Why do setuid perl scripts complain about kernel problems?\nSome operating systems have bugs in the kernel that make setuid scripts\ninherently insecure. Perl gives you a number of options (described in\nperlsec) to work around such systems.\n\nWhat's wrong with using backticks in a void context?\nStrictly speaking, nothing. Stylistically speaking, it's not a good way\nto write maintainable code. Perl has several operators for running\nexternal commands. Backticks are one; they collect the output from the\ncommand for use in your program. The \"system\" function is another; it\ndoesn't do this.\n\nWriting backticks in your program sends a clear message to the readers\nof your code that you wanted to collect the output of the command. Why\nsend a clear message that isn't true?\n\nConsider this line:\n\n`cat /etc/termcap`;\n\nYou forgot to check $? to see whether the program even ran correctly.\nEven if you wrote\n\nprint `cat /etc/termcap`;\n\nthis code could and probably should be written as\n\nsystem(\"cat /etc/termcap\") == 0\nor die \"cat program failed!\";\n\nwhich will echo the cat command's output as it is generated, instead of\nwaiting until the program has completed to print it out. It also checks\nthe return value.\n\n\"system\" also provides direct control over whether shell wildcard\nprocessing may take place, whereas backticks do not.\n\nIs there a way to hide perl's command line from programs such as \"ps\"?\nFirst of all note that if you're doing this for security reasons (to\navoid people seeing passwords, for example) then you should rewrite your\nprogram so that critical information is never given as an argument.\nHiding the arguments won't make your program completely secure.\n\nTo actually alter the visible command line, you can assign to the\nvariable $0 as documented in perlvar. This won't work on all operating\nsystems, though. Daemon programs like sendmail place their state there,\nas in:\n\n$0 = \"orcus [accepting connections]\";\n\nHow do I avoid zombies on a Unix system?\nUse the reaper code from \"Signals\" in perlipc to call \"wait()\" when a\nSIGCHLD is received, or else use the double-fork technique described in\n\"How do I start a process in the background?\" in perlfaq8.\n",
            "subsections": []
        },
        "Found in /usr/share/perl/5.34/pod/perlfaq9.pod": {
            "content": "How do I check a valid mail address?\n(partly contributed by Aaron Sherman)\n\nThis isn't as simple a question as it sounds. There are two parts:\n\na) How do I verify that an email address is correctly formatted?\n\nb) How do I verify that an email address targets a valid recipient?\n\nWithout sending mail to the address and seeing whether there's a human\non the other end to answer you, you cannot fully answer part *b*, but\nthe Email::Valid module will do both part *a* and part *b* as far as you\ncan in real-time.\n\nOur best advice for verifying a person's mail address is to have them\nenter their address twice, just as you normally do to change a password.\nThis usually weeds out typos. If both versions match, send mail to that\naddress with a personal message. If you get the message back and they've\nfollowed your directions, you can be reasonably assured that it's real.\n\nA related strategy that's less open to forgery is to give them a PIN\n(personal ID number). Record the address and PIN (best that it be a\nrandom one) for later processing. In the mail you send, include a link\nto your site with the PIN included. If the mail bounces, you know it's\nnot valid. If they don't click on the link, either they forged the\naddress or (assuming they got the message) following through wasn't\nimportant so you don't need to worry about it.\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}