[lug] kinda OT perl question

j davis davis_compz at hotmail.com
Sun Jun 9 20:47:51 MDT 2002


thanks everybody..changing $foo = <> to chomp($tmp=<STDIN>); fixed 
everything
the how to i use has only one example of getting user input and they did it
the wrong way.

thanks,
jd

also...for the newbies (as i still am) when im done with the scrp blug 
helped
me on ill post it. It a text based cheesy interface for lame...makes 
encodeing
mp3s idiot proof, i really needed this up till about 6 month ago!  :) I made 
this
scrp with the lack of a "idiots" man page. A man page that list the absolute
bare miniumum in a extremley understandable way. A man page that know the 
most
likley use of the program and only displays the neede options to get off the 
ground!

example....man smbclient

instead of that output the man (idiot) would say

to see shares on the computer BILLY ...

smbclient -L //billy -U your_username

to get files using samba ftp from the computer BILLY's C$ share....

if billy is a windoz machine:
smbclient ////billy//C$ -U your_username

if billy is unix style and you had a share named C$:
smbclient //billy/C$ -U your_username








>From: "Timothy C. Klein" <teece at silverklein.net>
>Reply-To: lug at lug.boulder.co.us
>To: lug at lug.boulder.co.us
>Subject: Re: [lug] perl question
>Date: Sun, 9 Jun 2002 18:22:27 -0600
>MIME-Version: 1.0
>Received: from [66.54.152.73] by hotmail.com (3.2) with ESMTP id 
>MHotMailBECD3C330038400432564236984909400; Sun, 09 Jun 2002 17:22:12 -0700
>Received: (qmail 1563 invoked by uid 0); 10 Jun 2002 00:22:06 -0000
>Received: from localhost (HELO community.tummy.com) 
>(?9CdE+0poY5iFXakJDYdMSU6el48CccHM?@127.0.0.1)  by localhost with SMTP; 10 
>Jun 2002 00:22:03 -0000
>Received: (qmail 1493 invoked by alias); 10 Jun 2002 00:21:20 -0000
>Received: (qmail 1490 invoked by uid 0); 10 Jun 2002 00:21:20 -0000
>Received: from i148.denver.dsl.forethought.net (HELO mail.silverklein.net) 
>(208.203.138.148)  by community.tummy.com with SMTP; 10 Jun 2002 00:21:18 
>-0000
>Received: from teece by mail.silverklein.net with local (Exim 3.35 #1 
>(Debian))id 17HCx1-0003kg-00for <lug at lug.boulder.co.us>; Sun, 09 Jun 2002 
>18:22:27 -0600
>From lug-admin at lug.boulder.co.us Sun, 09 Jun 2002 17:22:44 -0700
>Return-Path: <alias-blug_dom-lug-owner at lug.boulder.co.us>
>Delivered-To: mailman-lists.lug.boulder.co.us-lug at lists.lug.boulder.co.us
>Delivered-To: alias-blug_dom-lug at lug.boulder.co.us
>Message-ID: <20020610002227.GB14357 at keats>
>Mail-Followup-To: lug at lug.boulder.co.us
>References: <F263AjcbYj58DN94s3z0001a095 at hotmail.com>
>In-Reply-To: <F263AjcbYj58DN94s3z0001a095 at hotmail.com>
>User-Agent: Mutt/1.3.28i
>X-Editor: Vim http://www.vim.org/
>X-Info: http://208.203.138.148
>X-Operating-System: Linux/2.4.18f (i686)
>X-Uptime: 18:15:14 up 5 days, 16:07,  7 users,  load average: 1.03, 1.05, 
>1.10
>Sender: lug-admin at lug.boulder.co.us
>Errors-To: lug-admin at lug.boulder.co.us
>X-BeenThere: lug at lug.boulder.co.us
>X-Mailman-Version: 2.0.11
>Precedence: bulk
>List-Help: <mailto:lug-request at lug.boulder.co.us?subject=help>
>List-Post: <mailto:lug at lug.boulder.co.us>
>List-Subscribe: 
><http://lists.lug.boulder.co.us/mailman/listinfo/lug>,<mailto:lug-request at lug.boulder.co.us?subject=subscribe>
>List-Id: Boulder (Colorado) Linux Users Group -- General Mailing List 
><lug.lug.boulder.co.us>
>List-Unsubscribe: 
><http://lists.lug.boulder.co.us/mailman/listinfo/lug>,<mailto:lug-request at lug.boulder.co.us?subject=unsubscribe>
>List-Archive: <http://lists.lug.boulder.co.us/pipermail/lug/>
>
>* j davis (davis_compz at hotmail.com) wrote:
> > hello,
> >
> >  I have a small perl script that can be passed 2 args. before i made
> > the script take args it worked great , now that it takes args i am
> > having to rewrite the scrip because everytime i request user input 
>with..
> > $foo = <>;
> > it gets messed up and doesent ask for user input and just keeps going
> > assinging
> > $foo odd stuff. Before user input went smooth. the request for user 
>input is
> > in a while loop nested in a else. Dont know if that makes a diff but 
>thought
> > i should mention it. If this is not enough info or just plain dumb , i'm
> > sorry.
> > i will gladley post the scrip its very small.
>
>Doesn't the <> operator mean, read from all files provided on the
>command line, if given, if no files are given, read from STDIN?  I
>believe that is how it is supposed to work.  Your script probably worked
>sort of by accident before.  You should read from the user explicitly
>from standard in, as the <> operator is too smart, it is turning a
>DWIMmer acpect of Perl into a poorly incanted Dweomer.  (He
>he, I just love Wall's humor.  DWIM - Do What I Mean, requires a lot of
>behind the scenes magic.  Dweomer, an incantation or spell.  Thus, it
>often takes dweomer to get the dwimmer to work.  Here, it ain't.
>Working, that is).
>
>You would be better off getting info from the user thus:
>
>chomp($tmp=<STDIN>);
>
>Kill the chomp if you really want the extra line feed that might
>(probably) be there at the end.
>
>HTH,
>
>Tim
>--
>==============================================
>== Timothy Klein || teece at silverklein.net   ==
>== ---------------------------------------- ==
>== "Hello, World" 17 Errors, 31 Warnings... ==
>==============================================
>_______________________________________________
>Web Page:  http://lug.boulder.co.us
>Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>Join us on IRC: lug.boulder.co.us port=6667 channel=#colug




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.




More information about the LUG mailing list