swayam panda am Donnerstag, 22. Dezember 2005 05.49:
> Hi All,
Hello Swayam
> What is the difference between
>
> foreach ( system ls) {
>
> if (/1.pl/) {
> print ;}}
> Here the output is all the file of the CWD.
Called this way, ls prints directly to STDOUT, and system returns the status
of the system call. Return values are *not* the file names.
see perldoc -f system
> and
>
> foreach ( ` ls`) {
>
> if (/1.pl/) {
> print ;}}
>
> Here is output is only 1.pl
`ls`, or qx(ls), returns the file names in list context.
see perldoc -f qx
> Please explain this to me
Your first version will not do what you expect.
btw:
your regex /1.pl/ will also not do what you expect I think; you meant
/1\.pl/
your version will match a string containing a '1', then any char, then 'pl'.
see perldoc for:
perlretut
perlrequick
perlre
hth, joe
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>