One question about useage "<>" 
Author Message
 One question about useage "<>"

Hello forks.

I can do this:
              unlink <*.bun>;#delete all files named with .bun
but
              unlink '*.bun';
doesnt' work.

Tell me why?



Sat, 12 Mar 2005 11:05:55 GMT  
 One question about useage "<>"

Quote:

> I can do this:
>               unlink <*.bun>;#delete all files named with .bun

perldoc -f glob

Quote:
> but
>               unlink '*.bun';
> doesnt' work.

it does. but you probably don't have a file called '*.bun'
on your harddrive. if you had, it would be deleted.

--
http://www.tinita.de/        \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/      \     / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/   \    \ _,_\ __/\ __/_| /__/ perception



Sat, 12 Mar 2005 11:19:07 GMT  
 One question about useage "<>"

Quote:
> Hello forks.

> I can do this:
>               unlink <*.bun>;#delete all files named with .bun
> but
>               unlink '*.bun';
> doesnt' work.

> Tell me why?

What's to explain?  <string> does file globbing because <> is, among
other things, the file glob operator.  'string' quotes the enclosed
string.  It doesn't do globbing because it isn't the file glob operator.

Anno



Sat, 12 Mar 2005 11:26:02 GMT  
 One question about useage "<>"

Quote:

> Hello forks.

Heya spoon.

Quote:
> I can do this:
>               unlink <*.bun>;#delete all files named with .bun

   unlink glob '*.bun'; # a less confusing way of writing the same thing

Quote:
> but
>               unlink '*.bun';
> doesnt' work.

  ^^^^^^^^^^^^

What were you expecting that it would do?

If you have a file named with those 5 characters, it will be unlinked.

Quote:
> Tell me why?

   perldoc -f unlink

Says that unlink() takes a LIST of file names.

In your 1st call, you use file glob()ing to build up the list.

In your 2nd call, you supply a hard-coded one-element list.

--
    Tad McClellan                          SGML consulting

    Fort Worth, Texas



Sat, 12 Mar 2005 12:26:29 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. <<ENFofFTP "here-documnet" question

2. My <!--#exec cgi="\scripts\script.pl"-->command will not work

3. system("ed <stuff>")

4. About <SCRIPT language="PerlScript">

5. Text() ignored bind("<Tab>")

6. perl -pe "s/<er>/<er>\n"/g": memory efficient version?

7. print <<"EOF";

8. print <<"ending_print_tag";

9. <<<<<< HELP >>>>>>>>

10. Question about "->" operator

11. Question on open (FILE, "+>$file")

 

 
Powered by phpBB® Forum Software