{
    "mode": "perldoc",
    "parameter": "read",
    "section": "-f",
    "url": "https://www.chedong.com/phpMan.php/perldoc/read/json",
    "generated": "2026-06-03T02:31:58Z",
    "sections": [],
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Shell builtin for retrieving data from `stdin`.",
        "examples": [
            {
                "description": "Store data that you type from the keyboard",
                "command": "read {{variable}}"
            },
            {
                "description": "Store each of the next lines you enter as values of an array",
                "command": "read -a {{array}}"
            },
            {
                "description": "Specify the number of maximum characters to be read",
                "command": "read -n {{character_count}} {{variable}}"
            },
            {
                "description": "Assign multiple values to multiple variables",
                "command": "read <<< \"{{The surname is Bond}}\" {{_ variable1 _ variable2}}"
            },
            {
                "description": "Do not let backslash (`\\`) act as an escape character",
                "command": "read -r {{variable}}"
            },
            {
                "description": "Display a prompt before the input",
                "command": "read -p \"{{Enter your input here: }}\" {{variable}}"
            },
            {
                "description": "Do not echo typed characters (silent mode)",
                "command": "read -s {{variable}}"
            },
            {
                "description": "Read `stdin` and perform an action on every line",
                "command": "cat {{/dev/stdin|path/to/file|...}} | while read line; do {{echo|ls|rm|...}} \"$line\"; done"
            }
        ]
    }
}