Author: admin
-
Special Variables
There are some variables which have a predefined and special meaning in Perl. They are the variables that use punctuation characters after the usual variable indicator ($, @, or %), such as $_ ( explained below ). Most of the special variables have an english like long name, e.g., Operating System Error variable $! can…
-
Node.js MongoDB Filter Query
The find() method is also used to filter the result on a specific parameter. You can filter the result by using a query object. Example Filter the records to retrieve the specific employee whose address is “Delhi”. Create a js file named “query1.js”, having the following code:PlayNextMute  FullscreenBackward Skip 10sPlay VideoForward Skip 10s Open the command…
-
Error Handling
The execution and the errors always go together. If you are opening a file which does not exist. then if you did not handle this situation properly then your program is considered to be of bad quality. The program stops if an error occurs. So a proper error handling is used to handle various type…
-
Directories
Following are the standard functions used to play with directories. Display all the Files There are various ways to list down all the files available in a particular directory. First let’s use the simple way to get and list down all the files using the glob operator − Here is another example, which opens a directory and…
-
File I/O
The basics of handling files are simple: you associate a filehandle with an external entity (usually a file) and then use a variety of operators and functions within Perl to read and update the data stored within the data stream associated with the filehandle. A filehandle is a named internal Perl structure that associates a physical file…
-
Node.js MongoDB Select Record
The findOne() method is used to select a single data from a collection in MongoDB. This method returns the first record of the collection. Example (Select Single Record) Select the first record from the ?employees? collection.PlayNextMute Current Time 0:03 / Duration 18:10 Loaded: 3.67%  Fullscreen Create a js file named “select.js”, having the following code: Open the command…
-
Formats
Perl uses a writing template called a ‘format’ to output reports. To use the format feature of Perl, you have to define a format first and then you can use that format to write formatted data. Define a Format Following is the syntax to define a Perl format − Here FormatName represents the name of the format.…
-
References
A Perl reference is a scalar data type that holds the location of another value which could be scalar, arrays, or hashes. Because of its scalar nature, a reference can be used anywhere, a scalar can be used. You can construct lists containing references to other lists, which can contain references to hashes, and so…
-
Node.js MongoDB Insert Record
The insertOne method is used to insert record in MongoDB’s collection. The first argument of the insertOne method is an object which contains the name and value of each field in the record you want to insert. Example (Insert Single record) Insert a record in “employees” collection.PlayNextMute Current Time 0:05 / Duration 18:10 Loaded: 4.04%  Fullscreen Create a…
-
Node.js MongoDB Create Collection
MongoDB is a NoSQL database so data is stored in collection instead of table. createCollection method is used to create a collection in MongoDB. Example Create a collection named “employees”. Create a js file named “employees.js”, having the following data:PauseNextMute Current Time 0:09 / Duration 18:10 Loaded: 4.77%  Fullscreen Open the command terminal and run the following command:…