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

Re: Avoiding duplicate filenames

by afoken (Chancellor)
on Sep 25, 2018 at 22:37 UTC ( [id://1223022]=note: print w/replies, xml ) Need Help??


in reply to Avoiding duplicate filenames

$filename = $dateadded."-" . join("-",@words) . ".html"; $filename_base = $filename; $filename_base =~ s/\.html//g; # check to see if filename is being used $SQL = "SELECT * FROM $database_table WHERE filename = '$filename' +"; &Do_SQL;

http://bobby-tables.com/

In other words: Use placeholders! Always.

http://bobby-tables.com/perl explains how.

(And get rid of abusing global variables as parameters for functions, and calling functions with an '&' prefix. Both is considered bad style, and both may have unwanted side effects.)

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: Avoiding duplicate filenames
by htmanning (Friar) on Sep 25, 2018 at 23:38 UTC
    Understood. As someone mentioned earlier this is old cold. It was originally written in 1994 and is Perl 4. Thanks everyone for the input.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 18:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found