Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Creating Metadata from Text File

by Trihedralguy (Pilgrim)
on Jul 23, 2007 at 12:44 UTC ( [id://628230]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Creating Metadata from Text File
in thread Creating Metadata from Text File

I've never done anything like this before:
( @ARGV == 2 and -f $ARGV[0] and -f $ARGV[1] ) or die "Usage: $0 stopword.list document.file\n";

What is going on here? When I run this code, it askes me the die like. I dont understand.

Replies are listed 'Best First'.
Re^5: Creating Metadata from Text File
by graff (Chancellor) on Jul 25, 2007 at 01:13 UTC
    That's a way of conveying a "usage synopsis" to a user when the command is run without appropriate arguments. In this case, the "synopsis" is a message that says the user should enter the name of the command (i.e. the name of the perl script) followed by the name of a stopword list file, followed by the name of a document text file.

    The part between parentheses tests whether @ARGV contains two elements, and then whether each element is the name of an existing data file. If any of those three conditions is false, it goes into the "or die ..." clause, and the program exits with the usage synopsis.

    In case your shell environment requires that you run "perl.exe" followed by the name of your script, just add the names of the two data files after the name of the script in order to get it to actually run with those two files as input. Don't forget to redirect STDOUT to a file:

    perl name_of_script.pl stopword.file doc.file > table.file

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-28 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found