Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: This is not a pipe

by pijll (Beadle)
on Mar 11, 2005 at 23:26 UTC ( [id://438839]=note: print w/replies, xml ) Need Help??


in reply to This is not a pipe

-p '|'

Replies are listed 'Best First'.
Re^2: This is not a pipe
by Tanktalus (Canon) on Mar 12, 2005 at 01:21 UTC

    I like it. Although I think you meant:

    !-p _

      -p is a test operator, so your expression is more or less equivalent to a question: "Is _ (=this) not a pipe?".

      At least in Unix, '|' is not a valid filename, so -p '|' will always be false: "Is '|' a pipe? No.". So the ASCII representation of a pipe, '|', is never a pipe itself, which is exactly what Magritte meant with his painting.

        I've seen this assertion several times now, though the last time was a while ago. It hasn't gotten any more correct in the interim.

        $ touch \| $ file !$ file \| |: empty $ ls -l \| -rw-r--r-- 1 chemboy users 0 Mar 14 00:09 |

        That, for the record, was on Gentoo Linux on a G4, but similar results can be readily obtained on other platforms.



        If God had meant us to fly, he would *never* have given us the railroads.
            --Michael Flanders

Re^2: This is not a pipe
by Zaxo (Archbishop) on Mar 12, 2005 at 08:55 UTC

    Or, taking "this" to be $_ as we do, -p and print, print q m n'est pas une pipem, $/; (yes, I mean that ;-)

    After Compline,
    Zaxo

      It's too late now, but if perl had added a special syntax of m!! to indicate a negated match we could use m!\|!. As it is we have a modified form of one of sfink's suggestions: $_ !~ m/\|/.

      Also, what about?

      pipe(STDIN, STDOUT); #Optional: $|--, print STDOUT "This is not a pipe\n" ne <STDIN>;

      --
      I'm not belgian but I play one on TV. On dit que je parle comme un belge aussi.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://438839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-18 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found